Changes on the server.json format and the API (#562)
This commit is contained in:
parent
4962609697
commit
b21c6f564d
1 changed files with 4056 additions and 5608 deletions
|
|
@ -31,20 +31,28 @@ type ServerFilter struct {
|
|||
|
||||
// Database defines the interface for database operations
|
||||
type Database interface {
|
||||
// Retrieve server entries with optional filtering
|
||||
List(ctx context.Context, tx pgx.Tx, filter *ServerFilter, cursor string, limit int) ([]*apiv0.ServerJSON, string, error)
|
||||
// Retrieve a single server by its version ID
|
||||
GetByVersionID(ctx context.Context, tx pgx.Tx, versionID string) (*apiv0.ServerJSON, error)
|
||||
// Retrieve latest version of a server by server ID
|
||||
GetByServerID(ctx context.Context, tx pgx.Tx, serverID string) (*apiv0.ServerJSON, error)
|
||||
// Retrieve specific version of a server by server ID and version
|
||||
GetByServerIDAndVersion(ctx context.Context, tx pgx.Tx, serverID string, version string) (*apiv0.ServerJSON, error)
|
||||
// Retrieve all versions of a server by server ID
|
||||
GetAllVersionsByServerID(ctx context.Context, tx pgx.Tx, serverID string) ([]*apiv0.ServerJSON, error)
|
||||
// CreateServer inserts a new server version
|
||||
CreateServer(ctx context.Context, tx pgx.Tx, newServer *apiv0.ServerJSON) (*apiv0.ServerJSON, error)
|
||||
// CreateServer inserts a new server version with official metadata
|
||||
CreateServer(ctx context.Context, tx pgx.Tx, serverJSON *apiv0.ServerJSON, officialMeta *apiv0.RegistryExtensions) (*apiv0.ServerResponse, error)
|
||||
// UpdateServer updates an existing server record
|
||||
UpdateServer(ctx context.Context, tx pgx.Tx, id string, server *apiv0.ServerJSON) (*apiv0.ServerJSON, error)
|
||||
UpdateServer(ctx context.Context, tx pgx.Tx, serverName, version string, serverJSON *apiv0.ServerJSON) (*apiv0.ServerResponse, error)
|
||||
// SetServerStatus updates the status of a specific server version
|
||||
SetServerStatus(ctx context.Context, tx pgx.Tx, serverName, version string, status string) (*apiv0.ServerResponse, error)
|
||||
// ListServers retrieve server entries with optional filtering
|
||||
ListServers(ctx context.Context, tx pgx.Tx, filter *ServerFilter, cursor string, limit int) ([]*apiv0.ServerResponse, string, error)
|
||||
// GetServerByName retrieve a single server by its name
|
||||
GetServerByName(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)
|
||||
// GetServerByNameAndVersion retrieve specific version of a server by server name and version
|
||||
GetServerByNameAndVersion(ctx context.Context, tx pgx.Tx, serverName string, version string) (*apiv0.ServerResponse, error)
|
||||
// GetAllVersionsByServerName retrieve all versions of a server by server name
|
||||
GetAllVersionsByServerName(ctx context.Context, tx pgx.Tx, serverName string) ([]*apiv0.ServerResponse, error)
|
||||
// GetCurrentLatestVersion retrieve the current latest version of a server by server name
|
||||
GetCurrentLatestVersion(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)
|
||||
// CountServerVersions count the number of versions for a server
|
||||
CountServerVersions(ctx context.Context, tx pgx.Tx, serverName string) (int, error)
|
||||
// CheckVersionExists check if a specific version exists for a server
|
||||
CheckVersionExists(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error)
|
||||
// UnmarkAsLatest marks the current latest version of a server as no longer latest
|
||||
UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error
|
||||
// AcquirePublishLock acquires an exclusive advisory lock for publishing a server
|
||||
// This prevents race conditions when multiple versions are published concurrently
|
||||
AcquirePublishLock(ctx context.Context, tx pgx.Tx, serverName string) error
|
||||
|
|
|
|||
Loading…
Reference in a new issue