Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶
func CompareVersions(version1 string, version2 string, timestamp1 time.Time, timestamp2 time.Time) int
CompareVersions implements the versioning strategy agreed upon in the discussion: 1. If both versions are valid semver, use semantic version comparison 2. If neither are valid semver, use publication timestamp (return 0 to indicate equal for sorting) 3. If one is semver and one is not, the semver version is always considered higher
func IsSemanticVersion ¶
IsSemanticVersion checks if a version string follows semantic versioning format Uses the official golang.org/x/mod/semver package for validation Requires exactly three parts: major.minor.patch (optionally with prerelease/build)
Types ¶
type RegistryService ¶
type RegistryService interface {
// ListServers retrieve all servers with optional filtering
ListServers(ctx context.Context, filter *database.ServerFilter, cursor string, limit int) ([]*apiv0.ServerResponse, string, error)
// GetServerByName retrieve latest version of a server by server name
GetServerByName(ctx context.Context, serverName string) (*apiv0.ServerResponse, error)
// GetServerByNameAndVersion retrieve specific version of a server by server name and version
GetServerByNameAndVersion(ctx context.Context, serverName string, version string) (*apiv0.ServerResponse, error)
// GetAllVersionsByServerName retrieve all versions of a server by server name
GetAllVersionsByServerName(ctx context.Context, serverName string) ([]*apiv0.ServerResponse, error)
// CreateServer creates a new server version
CreateServer(ctx context.Context, req *apiv0.ServerJSON) (*apiv0.ServerResponse, error)
// UpdateServer updates an existing server and optionally its status
UpdateServer(ctx context.Context, serverName, version string, req *apiv0.ServerJSON, newStatus *string) (*apiv0.ServerResponse, error)
}
RegistryService defines the interface for registry operations
func NewRegistryService ¶
func NewRegistryService(db database.Database, cfg *config.Config) RegistryService
NewRegistryService creates a new registry service with the provided database