store

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: EPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeScopeController = "controller"
	RuntimeScopeLocal      = "local"
)

Runtime container ref scopes stored in runtime_container_refs.scope.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerState

type ContainerState struct {
	MsUUID     string
	Scope      string
	WorkloadID string
	SandboxID  string
}

ContainerState holds workload and sandbox container IDs for a microservice at a scope.

type DB

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

DB wraps the SQLite database connection

func GetInstance

func GetInstance() *DB

GetInstance returns the singleton DB instance

func (*DB) ClearAllControllerVolumeMounts

func (d *DB) ClearAllControllerVolumeMounts() error

ClearAllControllerVolumeMounts removes all controller volume mount rows (used on deprovision).

func (*DB) ClearControllerMicroserviceRuntimeFields

func (d *DB) ClearControllerMicroserviceRuntimeFields() error

ClearControllerMicroserviceRuntimeFields clears ephemeral runtime columns while keeping spec rows.

func (*DB) ClearControllerMicroservices

func (d *DB) ClearControllerMicroservices() error

ClearControllerMicroservices removes all controller microservice rows (used on deprovision).

func (*DB) ClearControllerRegistries

func (d *DB) ClearControllerRegistries() error

ClearControllerRegistries removes all controller registry rows (used on deprovision).

func (*DB) ClearLocalRuntimeClasses

func (d *DB) ClearLocalRuntimeClasses() error

ClearLocalRuntimeClasses removes all RuntimeClass rows.

func (*DB) ClearLocalWorkloadRuntimeFields

func (d *DB) ClearLocalWorkloadRuntimeFields() error

ClearLocalWorkloadRuntimeFields clears runtime tracking on local workload rows.

func (*DB) ClearLocalWorkloads

func (d *DB) ClearLocalWorkloads() error

ClearLocalWorkloads removes all local workload records.

func (*DB) ClearRuntimeContainerRefs

func (d *DB) ClearRuntimeContainerRefs(scope string) error

ClearRuntimeContainerRefs removes runtime container ref rows. When scope is non-empty, only rows matching that scope are deleted.

func (*DB) ClearServiceAccountTokens

func (d *DB) ClearServiceAccountTokens() error

ClearServiceAccountTokens removes all token metadata rows.

func (*DB) Close

func (d *DB) Close() error

Close checkpoints the WAL (TRUNCATE) then closes the connection. Production path: internal/supervisor.(*Supervisor).Stop() calls store.GetInstance().Close() last.

func (*DB) Conn

func (d *DB) Conn() *sql.DB

Conn returns the underlying *sql.DB

func (*DB) DeleteAgentPrivateKey

func (d *DB) DeleteAgentPrivateKey() error

DeleteAgentPrivateKey removes the provisioned private key payload.

func (*DB) DeleteControllerVolumeMount

func (d *DB) DeleteControllerVolumeMount(uuid string) error

DeleteControllerVolumeMount removes a controller volume mount record by UUID.

func (*DB) DeleteEdgeGuardSignature

func (d *DB) DeleteEdgeGuardSignature() error

DeleteEdgeGuardSignature removes the stored edgeguard signature JWT.

func (*DB) DeleteLocalRegistry

func (d *DB) DeleteLocalRegistry(id int) error

DeleteLocalRegistry deletes a local registry by ID.

func (*DB) DeleteLocalRuntimeClass

func (d *DB) DeleteLocalRuntimeClass(name string) error

DeleteLocalRuntimeClass deletes one RuntimeClass by name.

func (*DB) DeleteLocalWorkload

func (d *DB) DeleteLocalWorkload(id string) error

DeleteLocalWorkload removes a local workload record by id.

func (*DB) DeleteRuntimeContainerRef

func (d *DB) DeleteRuntimeContainerRef(msUUID, scope string) error

DeleteRuntimeContainerRef removes the runtime container ref for msUUID at scope.

func (*DB) DeleteSystemControlPlane

func (d *DB) DeleteSystemControlPlane() error

DeleteSystemControlPlane removes the singleton system control plane row.

func (*DB) EnsureDefaultControllerRegistries

func (d *DB) EnsureDefaultControllerRegistries() error

EnsureDefaultControllerRegistries ensures docker.io and from_cache defaults exist.

func (*DB) EnsureDefaultLocalRegistries

func (d *DB) EnsureDefaultLocalRegistries() error

EnsureDefaultLocalRegistries ensures default public registries exist in local table.

func (*DB) FindLocalWorkloadsByAppAndName

func (d *DB) FindLocalWorkloadsByAppAndName(application, name string) ([]*models.LocalDeployedMicroservice, error)

FindLocalWorkloadsByAppAndName finds local workloads by app/name.

func (*DB) GetAgentPrivateKey

func (d *DB) GetAgentPrivateKey() (privateKeyB64 string, found bool, err error)

GetAgentPrivateKey reads the provisioned private key payload (base64 JWK). Returns found=false when there is no stored key.

func (*DB) GetControllerVolumeMountByUUID

func (d *DB) GetControllerVolumeMountByUUID(uuid string) (*VolumeMountRecord, error)

GetControllerVolumeMountByUUID retrieves a single controller volume mount record by UUID.

func (*DB) GetEdgeGuardSignature

func (d *DB) GetEdgeGuardSignature() (signature string, found bool, err error)

GetEdgeGuardSignature reads the current edgeguard hardware signature JWT. Returns found=false when there is no stored signature.

func (*DB) GetLocalRegistry

func (d *DB) GetLocalRegistry(id int) (*models.Registry, error)

GetLocalRegistry gets one local registry by ID.

func (*DB) GetLocalRuntimeClass

func (d *DB) GetLocalRuntimeClass(name string) (*models.LocalRuntimeClass, error)

GetLocalRuntimeClass returns one RuntimeClass by name.

func (*DB) GetLocalWorkload

func (d *DB) GetLocalWorkload(id string) (*models.LocalDeployedMicroservice, error)

GetLocalWorkload retrieves one local workload record by id.

func (*DB) GetRuntimeContainerRef

func (d *DB) GetRuntimeContainerRef(msUUID, scope string) (*ContainerState, error)

GetRuntimeContainerRef returns the runtime container ref for msUUID at scope. Returns nil if not found or DB not opened.

func (*DB) GetSystemControlPlane

func (d *DB) GetSystemControlPlane() (*models.ControlPlaneDeployment, bool, error)

GetSystemControlPlane reads the singleton system control plane row. Returns found=false when no deployment is stored.

func (*DB) ListActiveServiceAccountTokens

func (d *DB) ListActiveServiceAccountTokens() ([]*models.ServiceAccountToken, error)

ListActiveServiceAccountTokens lists non-revoked token metadata.

func (*DB) ListLocalRuntimeClasses

func (d *DB) ListLocalRuntimeClasses() ([]*models.LocalRuntimeClass, error)

ListLocalRuntimeClasses returns all RuntimeClass rows ordered by name.

func (*DB) ListLocalWorkloads

func (d *DB) ListLocalWorkloads() ([]*models.LocalDeployedMicroservice, error)

ListLocalWorkloads returns all local workload records.

func (*DB) ListServiceAccountTokens

func (d *DB) ListServiceAccountTokens() ([]*models.ServiceAccountToken, error)

ListServiceAccountTokens lists token metadata.

func (*DB) LoadAllControllerVolumeMounts

func (d *DB) LoadAllControllerVolumeMounts() ([]VolumeMountRecord, error)

LoadAllControllerVolumeMounts retrieves all controller volume mount records.

func (*DB) LoadControllerMicroservices

func (d *DB) LoadControllerMicroservices() ([]*models.Microservice, error)

LoadControllerMicroservices retrieves all controller microservices ordered by uuid.

func (*DB) LoadControllerRegistries

func (d *DB) LoadControllerRegistries() ([]*models.Registry, error)

LoadControllerRegistries retrieves all controller registries ordered by id.

func (*DB) LoadLocalRegistries

func (d *DB) LoadLocalRegistries() ([]*models.Registry, error)

LoadLocalRegistries retrieves all local registries ordered by id.

func (*DB) Open

func (d *DB) Open(dir string) error

Open opens (or creates) the SQLite database at the given directory and runs migrations

func (*DB) ReplaceAllControllerVolumeMounts

func (d *DB) ReplaceAllControllerVolumeMounts(records []VolumeMountRecord) error

ReplaceAllControllerVolumeMounts atomically replaces all controller volume mount rows. Used by the volume mount manager's full-save on every write.

func (*DB) RevokeAllServiceAccountTokens

func (d *DB) RevokeAllServiceAccountTokens(revokedAtSec int64) error

RevokeAllServiceAccountTokens marks all tokens revoked.

func (*DB) RevokeServiceAccountToken

func (d *DB) RevokeServiceAccountToken(jti string, revokedAtSec int64) error

RevokeServiceAccountToken revokes a token by JTI.

func (*DB) SaveControllerMicroservices

func (d *DB) SaveControllerMicroservices(microservices []*models.Microservice) error

SaveControllerMicroservices replaces all controller microservice rows in a single transaction.

func (*DB) SaveControllerRegistries

func (d *DB) SaveControllerRegistries(registries []*models.Registry) error

SaveControllerRegistries replaces all controller registry rows in a single transaction.

func (*DB) UpsertAgentPrivateKey

func (d *DB) UpsertAgentPrivateKey(privateKeyB64 string) error

UpsertAgentPrivateKey stores the provisioned private key payload (base64 JWK).

func (*DB) UpsertControllerRegistry

func (d *DB) UpsertControllerRegistry(reg *models.Registry) error

UpsertControllerRegistry inserts or updates one controller registry row.

func (*DB) UpsertControllerVolumeMount

func (d *DB) UpsertControllerVolumeMount(rec VolumeMountRecord) error

UpsertControllerVolumeMount inserts or replaces a controller volume mount record.

func (*DB) UpsertEdgeGuardSignature

func (d *DB) UpsertEdgeGuardSignature(jwt string) error

UpsertEdgeGuardSignature stores the current edgeguard hardware signature JWT.

func (*DB) UpsertLocalRegistry

func (d *DB) UpsertLocalRegistry(reg *models.Registry) error

UpsertLocalRegistry inserts or updates one local registry row.

func (*DB) UpsertLocalRuntimeClass

func (d *DB) UpsertLocalRuntimeClass(rc *models.LocalRuntimeClass) error

UpsertLocalRuntimeClass inserts or updates one RuntimeClass row.

func (*DB) UpsertLocalWorkload

func (d *DB) UpsertLocalWorkload(ms *models.LocalDeployedMicroservice) error

UpsertLocalWorkload upserts a local workload record.

func (*DB) UpsertRuntimeContainerRef

func (d *DB) UpsertRuntimeContainerRef(msUUID, scope, workloadID, sandboxID string) error

UpsertRuntimeContainerRef upserts a runtime container ref row.

func (*DB) UpsertServiceAccountToken

func (d *DB) UpsertServiceAccountToken(token *models.ServiceAccountToken) error

UpsertServiceAccountToken upserts token metadata.

func (*DB) UpsertSystemControlPlane

func (d *DB) UpsertSystemControlPlane(dep *models.ControlPlaneDeployment) error

UpsertSystemControlPlane stores the singleton system control plane row.

type VolumeMountRecord

type VolumeMountRecord struct {
	UUID          string
	Name          string
	Version       float64
	Kind          string // "SECRET" or "CONFIGMAP"
	Checksum      string
	Microservices []string       // stored as JSON TEXT array
	Data          map[string]any // stored as JSON TEXT (key->base64 pairs)
	UpdatedAt     int64
}

VolumeMountRecord represents a single volume mount index entry. UUID, Name, Version, Kind, Checksum are real typed columns. Microservices and Data are JSON-serialized TEXT columns.

Jump to

Keyboard shortcuts

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