Documentation
¶
Overview ¶
Package controlplane persists global Pitcrew definitions.
Index ¶
- Variables
- func DatabasePath() (string, error)
- type ContractSummary
- type MigrationSummary
- type MigrationValidationFailure
- type Store
- func (s *Store) Close() error
- func (s *Store) GetContract(ctx context.Context, id string, version int) (StoredContract, error)
- func (s *Store) GetMigration(ctx context.Context, contractID string, from, to int) (StoredMigration, error)
- func (s *Store) InstallContract(ctx context.Context, source []byte) (StoredContract, bool, error)
- func (s *Store) InstallMigration(ctx context.Context, source []byte) (StoredMigration, bool, error)
- func (s *Store) ListContracts(ctx context.Context) ([]ContractSummary, error)
- func (s *Store) ListMigrations(ctx context.Context) ([]MigrationSummary, error)
- type StoredContract
- type StoredMigration
- type ValidationFailure
Constants ¶
This section is empty.
Variables ¶
var ( // ErrContractNotFound indicates that a requested contract version is absent. ErrContractNotFound = errors.New("contract version not found") // ErrContractVersionConflict indicates an attempt to replace an immutable version. ErrContractVersionConflict = errors.New("contract version already exists with different content") // ErrMigrationNotFound indicates that a requested path is absent. ErrMigrationNotFound = errors.New("migration path not found") // ErrMigrationPathConflict indicates an attempt to replace an immutable path. ErrMigrationPathConflict = errors.New("migration path already exists with different content") // ErrMigrationEndpointNotFound indicates that an endpoint contract is absent. ErrMigrationEndpointNotFound = errors.New("migration path contract endpoint is not installed") )
Functions ¶
func DatabasePath ¶
DatabasePath resolves the local control-plane database path.
Types ¶
type ContractSummary ¶
type ContractSummary struct {
ID string
Version int
APIVersion string
Name string
Description string
ContentHash string
InstalledAt time.Time
}
ContractSummary describes an installed version without loading its source.
type MigrationSummary ¶
type MigrationSummary struct {
Contract string
From int
To int
APIVersion string
ContentHash string
InstalledAt time.Time
}
MigrationSummary describes an installed path without loading its source.
type MigrationValidationFailure ¶
type MigrationValidationFailure struct {
Errors []migration.ValidationError
}
MigrationValidationFailure reports migration document violations.
func (*MigrationValidationFailure) Error ¶
func (e *MigrationValidationFailure) Error() string
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns the local SQLite control-plane database.
func (*Store) GetContract ¶
GetContract retrieves one immutable contract version.
func (*Store) GetMigration ¶
func (s *Store) GetMigration(ctx context.Context, contractID string, from, to int) (StoredMigration, error)
GetMigration retrieves one immutable migration path.
func (*Store) InstallContract ¶
InstallContract validates and immutably stores one contract version.
func (*Store) InstallMigration ¶
InstallMigration validates and immutably stores one forward migration path.
func (*Store) ListContracts ¶
func (s *Store) ListContracts(ctx context.Context) ([]ContractSummary, error)
ListContracts returns installed versions ordered by contract ID and version.
func (*Store) ListMigrations ¶
func (s *Store) ListMigrations(ctx context.Context) ([]MigrationSummary, error)
ListMigrations returns installed paths in stable contract/version order.
type StoredContract ¶
type StoredContract struct {
ID string
Version int
APIVersion string
Name string
Description string
SourceYAML []byte
CanonicalJSON []byte
ContentHash string
InstalledAt time.Time
}
StoredContract is one immutable contract version in the control plane.
type StoredMigration ¶
type StoredMigration struct {
Contract string
From int
To int
APIVersion string
SourceYAML []byte
CanonicalJSON []byte
ContentHash string
InstalledAt time.Time
}
StoredMigration is one immutable migration path in the control plane.
type ValidationFailure ¶
type ValidationFailure struct {
Errors []contract.ValidationError
}
ValidationFailure reports semantic or structural contract violations.
func (*ValidationFailure) Error ¶
func (e *ValidationFailure) Error() string