How enclaverunner/artifact-registry works
Project Type & Purpose
• Type: Backend microservice (Go) providing an artifact registry via gRPC.
• Purpose: Store and retrieve artifacts (binary blobs + metadata). Metadata is managed via an ORM layer; actual files live on the filesystem.
File Structure
• Top-level:
– main.go: service entrypoint
– config/config.go: loads runtime settings
– registry.proto + proto_gen: defines gRPC interface & generated code
– Dockerfile / docker-compose.test.yml: containerization & integration tests
– .github/workflows: CI/CD pipelines (build, test, release)
• Internal packages:
– orm/: metadata models, DB initialization (likely using GORM or similar)
– registry/: core service logic & interfaces
· filesystemRegistry/: filesystem-backed implementation
• Build & Release:
– Makefile, flake.nix/flake.lock: local dev/build reproducibility
– GitHub Actions: testing, image promotion, releases
Main Components & Their Boundaries
a. API Layer (gRPC Server):
• Generated stubs (proto_gen), handlers in registry/registry.go
• Exposes CreateArtifact, GetArtifact, ListArtifacts, etc.
b. Service Layer (Business Logic):
• registry/artifacts.go: orchestrates metadata + blob storage
• Defines a Registry interface implemented by filesystemRegistry
c. Persistence Layer:
• ORM sub-package: models, errors, metadata.go
• Connects to relational DB (Postgres/MySQL—configurable)
d. Storage Layer:
• filesystemRegistry: stores artifact blobs on local (or mounted) filesystem
• config: paths, permissions, retention policies
e. Configuration & Bootstrap:
• config/config.go → reads ENV/Nix/Docker settings
• main.go → initializes logger, config, DB (orm/init.go), gRPC server
f. Infrastructure & External Services:
• Relational database (external service)
• Filesystem (local or network mount)
• CI/CD (GitHub Actions)
• Docker registry (for container images)
Relationships & Data Flow
• Client → gRPC Endpoint
• gRPC Handler → Service (Registry interface)
• Service → ORM Layer (metadata CRUD)
• Service → FilesystemRegistry (blob store I/O)
• Database ←→ ORM
• Filesystem ←→ FilesystemRegistry
• CI/CD Pipelines → Docker build → Deployment
Architectural Patterns & Principles
• Layered Architecture: API → Service → Persistence → Storage
• Dependency Inversion: Registry interface decouples service from FS implementation
• Single Responsibility: each package has a clear role
• Configuration Centralization: all settings in config package
Final Checklist
• All components labeled clearly (e.g., “gRPC Server”, “Registry Service”, “ORM Data Layer”, “Filesystem Blob Store”).
• Proper grouping (e.g., “Application”, “Storage”, “CI/CD”).