Documentation
¶
Overview ¶
Package app provides application lifecycle management for the registry server.
Index ¶
- type AppComponents
- type RegistryApp
- type RegistryAppOptions
- func WithAddress(addr string) RegistryAppOptions
- func WithConfig(c *config.Config) RegistryAppOptions
- func WithDataDirectory(dir string) RegistryAppOptions
- func WithMiddlewares(mw ...func(http.Handler) http.Handler) RegistryAppOptions
- func WithRegistryHandlerFactory(f sources.RegistryHandlerFactory) RegistryAppOptions
- func WithStorageFactory(f storage.Factory) RegistryAppOptions
- func WithSyncManager(sm pkgsync.Manager) RegistryAppOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppComponents ¶
type AppComponents struct {
// SyncCoordinator manages background synchronization
SyncCoordinator coordinator.Coordinator
// RegistryService provides registry business logic
RegistryService service.RegistryService
}
AppComponents groups all application components
type RegistryApp ¶
type RegistryApp struct {
// contains filtered or unexported fields
}
RegistryApp encapsulates all components needed to run the registry API server It provides lifecycle management and graceful shutdown capabilities
func NewRegistryApp ¶
func NewRegistryApp( ctx context.Context, opts ...RegistryAppOptions, ) (*RegistryApp, error)
NewRegistryApp creates a new builder with the given configuration
func (*RegistryApp) GetConfig ¶
func (app *RegistryApp) GetConfig() *config.Config
GetConfig returns the application configuration
func (*RegistryApp) GetHTTPServer ¶
func (app *RegistryApp) GetHTTPServer() *http.Server
GetHTTPServer returns the HTTP server (useful for testing to get the actual port)
func (*RegistryApp) Start ¶
func (app *RegistryApp) Start() error
Start starts the application components (HTTP server and background sync) This method blocks until the HTTP server stops or encounters an error
type RegistryAppOptions ¶
type RegistryAppOptions func(*registryAppConfig) error
RegistryAppOptions is a function that configures the registry app builder
func WithAddress ¶
func WithAddress(addr string) RegistryAppOptions
WithAddress sets the HTTP server address
func WithConfig ¶
func WithConfig(c *config.Config) RegistryAppOptions
WithConfig sets the configuration
func WithDataDirectory ¶
func WithDataDirectory(dir string) RegistryAppOptions
WithDataDirectory sets the data directory for storage and status files
func WithMiddlewares ¶
func WithMiddlewares(mw ...func(http.Handler) http.Handler) RegistryAppOptions
WithMiddlewares sets custom HTTP middlewares
func WithRegistryHandlerFactory ¶ added in v0.3.0
func WithRegistryHandlerFactory(f sources.RegistryHandlerFactory) RegistryAppOptions
WithRegistryHandlerFactory allows injecting a custom registry handler factory (for testing)
func WithStorageFactory ¶ added in v0.4.4
func WithStorageFactory(f storage.Factory) RegistryAppOptions
WithStorageFactory allows injecting a custom storage factory (for testing)
func WithSyncManager ¶
func WithSyncManager(sm pkgsync.Manager) RegistryAppOptions
WithSyncManager allows injecting a custom sync manager (for testing)