app

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package app provides application lifecycle management for the registry server.

Index

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

func (*RegistryApp) Stop

func (app *RegistryApp) Stop(timeout time.Duration) error

Stop gracefully stops the application with the given timeout It stops the sync coordinator and then shuts down the HTTP server

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 WithDeploymentProvider

func WithDeploymentProvider(provider service.DeploymentProvider) RegistryAppOptions

WithDeploymentProvider allows injecting a custom deployment provider (for testing)

func WithMiddlewares

func WithMiddlewares(mw ...func(http.Handler) http.Handler) RegistryAppOptions

WithMiddlewares sets custom HTTP middlewares

func WithRegistryProvider

func WithRegistryProvider(provider service.RegistryDataProvider) RegistryAppOptions

WithRegistryProvider allows injecting a custom registry provider (for testing)

func WithSourceHandlerFactory

func WithSourceHandlerFactory(factory sources.SourceHandlerFactory) RegistryAppOptions

WithSourceHandlerFactory allows injecting a custom source handler factory (for testing)

func WithStatusPersistence

func WithStatusPersistence(sp status.StatusPersistence) RegistryAppOptions

WithStatusPersistence allows injecting custom status persistence (for testing)

func WithStorageManager

func WithStorageManager(sm sources.StorageManager) RegistryAppOptions

WithStorageManager allows injecting a custom storage manager (for testing)

func WithSyncManager

func WithSyncManager(sm pkgsync.Manager) RegistryAppOptions

WithSyncManager allows injecting a custom sync manager (for testing)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL