controlplane

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package controlplane persists global Pitcrew definitions.

Index

Constants

This section is empty.

Variables

View Source
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

func DatabasePath() (string, error)

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

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store owns the local SQLite control-plane database.

func Open

func Open(ctx context.Context, path string) (*Store, error)

Open opens a control-plane database and applies its technical schema.

func (*Store) Close

func (s *Store) Close() error

Close releases the database connection.

func (*Store) GetContract

func (s *Store) GetContract(ctx context.Context, id string, version int) (StoredContract, error)

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

func (s *Store) InstallContract(ctx context.Context, source []byte) (StoredContract, bool, error)

InstallContract validates and immutably stores one contract version.

func (*Store) InstallMigration

func (s *Store) InstallMigration(ctx context.Context, source []byte) (StoredMigration, bool, error)

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

Jump to

Keyboard shortcuts

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