Documentation
¶
Overview ¶
Package store implements PostgreSQL-backed SecondBox control-plane authority.
Index ¶
- Constants
- Variables
- type PostgresControlPlaneStore
- func (store *PostgresControlPlaneStore) AcquireLease(ctx context.Context, input ports.LeaseInput) (contracts.Lease, error)
- func (store *PostgresControlPlaneStore) AcquireWorkspaceMutation(ctx context.Context, input ports.WorkspaceMutationInput) (ports.HomeWorkspace, bool, error)
- func (store *PostgresControlPlaneStore) AppendAuditEvent(ctx context.Context, event contracts.AuditEvent) error
- func (store *PostgresControlPlaneStore) ApplyLifecycleAction(ctx context.Context, claim ports.LifecycleReconcileClaim, action string, ...) error
- func (store *PostgresControlPlaneStore) AuthenticateApplicationAuthority(ctx context.Context, bearerToken string, now time.Time) (ports.AuthenticatedApplicationAuthority, error)
- func (store *PostgresControlPlaneStore) AuthenticateTenantControllerAuthority(ctx context.Context, bearerToken string, now time.Time) (contracts.Principal, error)
- func (store *PostgresControlPlaneStore) ClaimLifecycle(ctx context.Context, workerID string, now time.Time, ...) (ports.LifecycleReconcileClaim, bool, error)
- func (store *PostgresControlPlaneStore) ClaimLifecycleBatch(ctx context.Context, workerID string, now time.Time, ...) ([]ports.LifecycleReconcileClaim, error)
- func (store *PostgresControlPlaneStore) Close()
- func (store *PostgresControlPlaneStore) CloseActivitySession(ctx context.Context, input ports.ActivityInput) (contracts.ActivitySession, error)
- func (store *PostgresControlPlaneStore) CloseManagedSubject(ctx context.Context, tenantRef string, subjectRef string, ...) (contracts.Subject, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CompleteWorkspaceMutation(ctx context.Context, input ports.WorkspaceMutationCompletion) (ports.HomeWorkspace, error)
- func (store *PostgresControlPlaneStore) CreateApplicationAuthority(ctx context.Context, authority contracts.ApplicationAuthority) (contracts.ApplicationCredentialResponse, error)
- func (store *PostgresControlPlaneStore) CreateManagedApplicationAuthority(ctx context.Context, authority contracts.ApplicationAuthority, ...) (contracts.ApplicationCredentialResponse, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CreateManagedSubject(ctx context.Context, subject contracts.Subject, ...) (contracts.Subject, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CreateManagedSubjectCleanup(ctx context.Context, tenantRef string, subjectRef string, ...) (contracts.Operation, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CreateManagedTenant(ctx context.Context, tenant contracts.Tenant, ...) (contracts.Tenant, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CreateManagedTenantControllerAuthority(ctx context.Context, authority contracts.TenantControllerAuthority, ...) (contracts.TenantControllerCredentialResponse, ports.AdminIdempotencyResult, ...)
- func (store *PostgresControlPlaneStore) CreateProfile(ctx context.Context, profile contracts.Profile, ...) (contracts.Profile, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) CreateRunnerPool(ctx context.Context, pool contracts.RunnerPool) (contracts.RunnerPool, error)
- func (store *PostgresControlPlaneStore) CreateSandbox(ctx context.Context, input ports.CreateSandboxInput) (contracts.Sandbox, contracts.Operation, bool, error)
- func (store *PostgresControlPlaneStore) CreateSnapshot(ctx context.Context, input ports.SnapshotCreationInput) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) CreateSubject(ctx context.Context, subject contracts.Subject) (contracts.Subject, error)
- func (store *PostgresControlPlaneStore) CreateTenant(ctx context.Context, tenant contracts.Tenant) (contracts.Tenant, error)
- func (store *PostgresControlPlaneStore) CreateTenantControllerAuthority(ctx context.Context, authority contracts.TenantControllerAuthority) (contracts.TenantControllerCredentialResponse, error)
- func (store *PostgresControlPlaneStore) DeleteSnapshot(ctx context.Context, input ports.SnapshotDeletionInput) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) DisableProfile(ctx context.Context, name string, expectedRevision int64, now time.Time, ...) (contracts.Profile, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) GetApplicationAuthority(ctx context.Context, tenantRef string, authorityID string) (contracts.ApplicationAuthority, error)
- func (store *PostgresControlPlaneStore) GetDeploymentUsage(ctx context.Context, limit int, cursor string, observedAt time.Time) (contracts.DeploymentUsage, error)
- func (store *PostgresControlPlaneStore) GetLeaseByID(ctx context.Context, tenantRef string, subjectRef string, leaseID string) (contracts.Lease, error)
- func (store *PostgresControlPlaneStore) GetOperation(ctx context.Context, tenantRef string, subjectRef string, operationID string) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) GetProfile(ctx context.Context, name string) (contracts.Profile, error)
- func (store *PostgresControlPlaneStore) GetRunner(ctx context.Context, runnerID string) (contracts.Runner, error)
- func (store *PostgresControlPlaneStore) GetRunnerPool(ctx context.Context, name string) (contracts.RunnerPool, error)
- func (store *PostgresControlPlaneStore) GetSandbox(ctx context.Context, tenantRef string, subjectRef string, sandboxID string) (contracts.Sandbox, error)
- func (store *PostgresControlPlaneStore) GetSandboxLifecyclePolicy(ctx context.Context, tenantRef string, subjectRef string, sandboxID string) (contracts.LifecyclePolicy, contracts.RetentionPolicy, error)
- func (store *PostgresControlPlaneStore) GetSnapshot(ctx context.Context, tenantRef string, subjectRef string, snapshotID string, ...) (contracts.Snapshot, error)
- func (store *PostgresControlPlaneStore) GetSubject(ctx context.Context, tenantRef, subjectRef string) (contracts.Subject, error)
- func (store *PostgresControlPlaneStore) GetSubjectUsage(ctx context.Context, tenantRef string, subjectRef string) (contracts.SubjectUsage, error)
- func (store *PostgresControlPlaneStore) GetTenant(ctx context.Context, tenantRef string) (contracts.Tenant, error)
- func (store *PostgresControlPlaneStore) GetTenantControllerAuthority(ctx context.Context, tenantRef string, authorityID string) (contracts.TenantControllerAuthority, error)
- func (store *PostgresControlPlaneStore) GetTenantOperation(ctx context.Context, tenantRef string, operationID string) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) GetTenantUsage(ctx context.Context, tenantRef string, limit int, cursor string, ...) (contracts.TenantUsage, error)
- func (store *PostgresControlPlaneStore) ListApplicationAuthorities(ctx context.Context, tenantRef, subjectRef string, limit int, cursor string) (contracts.ApplicationAuthorityPage, error)
- func (store *PostgresControlPlaneStore) ListAuditEvents(ctx context.Context, tenantRef string, limit int) ([]contracts.AuditEvent, error)
- func (store *PostgresControlPlaneStore) ListProfiles(ctx context.Context, limit int, cursor string) (contracts.ProfilePage, error)
- func (store *PostgresControlPlaneStore) ListRunnerPools(ctx context.Context, limit int, cursor string) (contracts.RunnerPoolPage, error)
- func (store *PostgresControlPlaneStore) ListRunners(ctx context.Context, poolName string, limit int, cursor string) (contracts.RunnerPage, error)
- func (store *PostgresControlPlaneStore) ListSandboxes(ctx context.Context, tenantRef string, subjectRef string, limit int, ...) (contracts.SandboxPage, error)
- func (store *PostgresControlPlaneStore) ListSnapshots(ctx context.Context, tenantRef string, subjectRef string, sandboxID string, ...) (contracts.SnapshotPage, error)
- func (store *PostgresControlPlaneStore) ListSubjects(ctx context.Context, tenantRef string, limit int, cursor string) (contracts.SubjectPage, error)
- func (store *PostgresControlPlaneStore) ListTenantControllerAuthorities(ctx context.Context, tenantRef string, limit int, cursor string) (contracts.TenantControllerAuthorityPage, error)
- func (store *PostgresControlPlaneStore) ListTenants(ctx context.Context, limit int, cursor string) (contracts.TenantPage, error)
- func (store *PostgresControlPlaneStore) OpenActivitySession(ctx context.Context, input ports.ActivityInput) (contracts.ActivitySession, error)
- func (store *PostgresControlPlaneStore) Ping(ctx context.Context) error
- func (store *PostgresControlPlaneStore) PingGuest(ctx context.Context, input ports.GenerationInput, liveness string) (contracts.Instance, error)
- func (store *PostgresControlPlaneStore) QueueExpiredSnapshotDelete(ctx context.Context, input ports.SnapshotRetentionInput) (bool, error)
- func (store *PostgresControlPlaneStore) ReadDeploymentTiming(ctx context.Context, since time.Time, until time.Time) (contracts.DeploymentTimingSummary, error)
- func (store *PostgresControlPlaneStore) ReadEgressContextPreflight(ctx context.Context) (contracts.EgressContextPreflight, error)
- func (store *PostgresControlPlaneStore) ReadMetricsSnapshot(ctx context.Context) (contracts.MetricsSnapshot, error)
- func (store *PostgresControlPlaneStore) ReadOperationTiming(ctx context.Context, tenantRef string, subjectRef string, operationID string) (contracts.OperationTiming, error)
- func (store *PostgresControlPlaneStore) ReadSandboxInspection(ctx context.Context, input ports.GenerationInput) (contracts.SandboxInspection, error)
- func (store *PostgresControlPlaneStore) ReadSandboxTiming(ctx context.Context, tenantRef string, subjectRef string, sandboxID string, ...) (contracts.SandboxTiming, error)
- func (store *PostgresControlPlaneStore) RegisterRunnerPool(ctx context.Context, pool contracts.RunnerPool) error
- func (store *PostgresControlPlaneStore) ReleaseLease(ctx context.Context, input ports.LeaseInput) (contracts.Lease, error)
- func (store *PostgresControlPlaneStore) RelocateSandbox(ctx context.Context, input ports.WorkspaceRelocationInput) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) RenewLease(ctx context.Context, input ports.LeaseInput) (contracts.Lease, error)
- func (store *PostgresControlPlaneStore) RestoreSnapshot(ctx context.Context, input ports.SnapshotRestoreInput) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) ReviseProfile(ctx context.Context, name string, revision contracts.ProfileRevision, ...) (contracts.Profile, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) RevokeApplicationAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.ApplicationAuthority, error)
- func (store *PostgresControlPlaneStore) RevokeManagedApplicationAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.ApplicationAuthority, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) RevokeManagedTenantControllerAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.TenantControllerAuthority, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) RevokeTenantControllerAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.TenantControllerAuthority, error)
- func (store *PostgresControlPlaneStore) RotateApplicationAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.ApplicationCredentialResponse, error)
- func (store *PostgresControlPlaneStore) RotateManagedApplicationAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.ApplicationCredentialResponse, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) RotateManagedTenantControllerAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.TenantControllerCredentialResponse, ports.AdminIdempotencyResult, ...)
- func (store *PostgresControlPlaneStore) RotateTenantControllerAuthority(ctx context.Context, tenantRef string, authorityID string, ...) (contracts.TenantControllerCredentialResponse, error)
- func (store *PostgresControlPlaneStore) SetSandboxDesiredState(ctx context.Context, input ports.LifecycleIntentInput) (contracts.Operation, error)
- func (store *PostgresControlPlaneStore) SetTenantState(ctx context.Context, tenantRef, targetState string, expectedRevision int64, ...) (contracts.Tenant, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) SweepSessionAccounting(ctx context.Context, now time.Time, activityRetention time.Duration, limit int) (int64, error)
- func (store *PostgresControlPlaneStore) TouchActivity(ctx context.Context, input ports.ActivityInput) (time.Time, error)
- func (store *PostgresControlPlaneStore) UpdateManagedSubjectQuota(ctx context.Context, tenantRef string, subjectRef string, ...) (contracts.Subject, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) UpdateManagedTenantEgressContext(ctx context.Context, tenantRef string, egressContext *string, ...) (contracts.Tenant, ports.AdminIdempotencyResult, error)
- func (store *PostgresControlPlaneStore) UpdateRunnerPool(ctx context.Context, name string, update contracts.UpdateRunnerPoolRequest, ...) (contracts.RunnerPool, error)
- func (store *PostgresControlPlaneStore) UpdateSandboxMetadata(ctx context.Context, input ports.UpdateSandboxMetadataInput) (contracts.Sandbox, error)
Constants ¶
const ( StageDurableAdmission = "durable_admission" StageLifecyclePickupNotify = "lifecycle_pickup_notify" StageLifecyclePickupDeadline = "lifecycle_pickup_deadline" StageLifecyclePickupImmediate = "lifecycle_pickup_immediate" )
Control-plane orchestration milestone names owned by this package. The placement and startup milestones stay literals inside the transactions that establish them, and the teardown milestones belong to lifecycleprojection.
Variables ¶
var OrchestrationStages = []string{ StageDurableAdmission, StageLifecyclePickupNotify, StageLifecyclePickupDeadline, StageLifecyclePickupImmediate, "workspace_ready", "placement_reconcile_started", "placement_effect_started", "placement_plan_ready", "placement_schedule_started", "placement_attempt_started", "placement_sandbox_locked", "placement_assignment_checked", "placement_candidates_locked", "placement_candidate_selected", "placement_ready", "startup_dispatched", "ready_projected", lifecycleprojection.StageTeardownDrainCommitted, lifecycleprojection.StageTeardownFenceDispatched, lifecycleprojection.StageTeardownFenceAcknowledged, lifecycleprojection.StageTeardownGenerationAdvanced, lifecycleprojection.StageTeardownStopCommitted, lifecycleprojection.StageTeardownWorkspaceDeleteDispatched, lifecycleprojection.StageTeardownFinalized, }
OrchestrationStages is the complete ordered vocabulary of provider-neutral control-plane milestones persisted to secondbox.operation_stage_timings. The order is the causal order of one Sandbox lifecycle, so a timing response can break equal-timestamp ties deterministically. Every stage a control-plane transaction writes must appear here or it stays invisible to the timing routes.
LifecyclePickup* names carry why the lifecycle worker was awake when it first claimed the Operation's Sandbox: a PostgreSQL commit notification, the bounded recovery poll deadline, or an immediate re-claim after the worker had just finished other work. Encoding the wake trigger in the stage name keeps the evidence fixed-cardinality and needs no extra column.
Functions ¶
This section is empty.
Types ¶
type PostgresControlPlaneStore ¶
type PostgresControlPlaneStore struct {
// contains filtered or unexported fields
}
PostgresControlPlaneStore persists standalone SecondBox authority.
func NewPostgresControlPlaneStore ¶
func NewPostgresControlPlaneStore(ctx context.Context, databaseURL string) (*PostgresControlPlaneStore, error)
NewPostgresControlPlaneStore connects to the required PostgreSQL authority.
func (*PostgresControlPlaneStore) AcquireLease ¶
func (store *PostgresControlPlaneStore) AcquireLease( ctx context.Context, input ports.LeaseInput, ) (contracts.Lease, error)
func (*PostgresControlPlaneStore) AcquireWorkspaceMutation ¶
func (store *PostgresControlPlaneStore) AcquireWorkspaceMutation( ctx context.Context, input ports.WorkspaceMutationInput, ) (ports.HomeWorkspace, bool, error)
AcquireWorkspaceMutation serializes all local workspace changes under the invariant row order Sandbox, Workspace, then Snapshot when present.
func (*PostgresControlPlaneStore) AppendAuditEvent ¶
func (store *PostgresControlPlaneStore) AppendAuditEvent( ctx context.Context, event contracts.AuditEvent, ) error
AppendAuditEvent persists service-layer mutation evidence.
func (*PostgresControlPlaneStore) ApplyLifecycleAction ¶
func (store *PostgresControlPlaneStore) ApplyLifecycleAction( ctx context.Context, claim ports.LifecycleReconcileClaim, action string, terminationReason string, now time.Time, nextReconcileAt time.Time, ) error
ApplyLifecycleAction commits one claimed transition only while owner and revision remain current.
A zero nextReconcileAt parks the Sandbox: the commit clears its durable deadline, which removes it from the claim scan until an external event schedules it again.
`revision` is the Sandbox's public ETag, and a `wait` changes no field a caller can observe, so a wait holds it — and updated_at with it — exactly where they were. Without that, a caller that reads a Sandbox and sends If-Match on what it read races a reconciliation it cannot see and loses the precondition to a transition that changed nothing.
The revision still fences the claim. Every action that changes durable state advances it, so a claim token that has committed such an action can never commit a second one, and a wait that holds the revision still requires reconcile_owner to name this claim's worker — which the commit clears.
func (*PostgresControlPlaneStore) AuthenticateApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) AuthenticateApplicationAuthority( ctx context.Context, bearerToken string, now time.Time, ) (ports.AuthenticatedApplicationAuthority, error)
AuthenticateApplicationAuthority resolves and verifies current durable application authority.
func (*PostgresControlPlaneStore) AuthenticateTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) AuthenticateTenantControllerAuthority( ctx context.Context, bearerToken string, now time.Time, ) (contracts.Principal, error)
AuthenticateTenantControllerAuthority resolves and verifies current durable controller authority.
func (*PostgresControlPlaneStore) ClaimLifecycle ¶
func (store *PostgresControlPlaneStore) ClaimLifecycle( ctx context.Context, workerID string, now time.Time, claimDuration time.Duration, wakeTrigger ports.LifecycleWakeTrigger, ) (ports.LifecycleReconcileClaim, bool, error)
ClaimLifecycle claims one due desired-state record with durable revision fencing.
func (*PostgresControlPlaneStore) ClaimLifecycleBatch ¶
func (store *PostgresControlPlaneStore) ClaimLifecycleBatch( ctx context.Context, workerID string, now time.Time, claimDuration time.Duration, batchSize int, wakeTrigger ports.LifecycleWakeTrigger, ) ([]ports.LifecycleReconcileClaim, error)
ClaimLifecycleBatch atomically claims a bounded ordered cohort. The caller still processes effects sequentially, so batching removes claim round trips without introducing concurrent serializable scheduler transactions.
func (*PostgresControlPlaneStore) Close ¶
func (store *PostgresControlPlaneStore) Close()
Close releases all PostgreSQL connections.
func (*PostgresControlPlaneStore) CloseActivitySession ¶
func (store *PostgresControlPlaneStore) CloseActivitySession( ctx context.Context, input ports.ActivityInput, ) (contracts.ActivitySession, error)
CloseActivitySession removes idle suppression but does not alter desired state.
func (*PostgresControlPlaneStore) CloseManagedSubject ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CloseManagedSubject( ctx context.Context, tenantRef string, subjectRef string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Subject, ports.AdminIdempotencyResult, error)
CloseManagedSubject atomically revokes application authority and closes admission.
func (*PostgresControlPlaneStore) CompleteWorkspaceMutation ¶
func (store *PostgresControlPlaneStore) CompleteWorkspaceMutation( ctx context.Context, input ports.WorkspaceMutationCompletion, ) (ports.HomeWorkspace, error)
CompleteWorkspaceMutation records runner evidence and clears exactly the matching durable slot in one transaction.
func (*PostgresControlPlaneStore) CreateApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateApplicationAuthority( ctx context.Context, authority contracts.ApplicationAuthority, ) (contracts.ApplicationCredentialResponse, error)
CreateApplicationAuthority generates and persists one application credential.
func (*PostgresControlPlaneStore) CreateManagedApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateManagedApplicationAuthority( ctx context.Context, authority contracts.ApplicationAuthority, idempotency ports.AdminIdempotencyInput, ) (contracts.ApplicationCredentialResponse, ports.AdminIdempotencyResult, error)
CreateManagedApplicationAuthority creates one idempotency-protected ceiling-checked application credential.
func (*PostgresControlPlaneStore) CreateManagedSubject ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateManagedSubject( ctx context.Context, subject contracts.Subject, idempotency ports.AdminIdempotencyInput, ) (contracts.Subject, ports.AdminIdempotencyResult, error)
CreateManagedSubject creates or replays one tenant-scoped Subject after ceiling checks.
func (*PostgresControlPlaneStore) CreateManagedSubjectCleanup ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateManagedSubjectCleanup( ctx context.Context, tenantRef string, subjectRef string, operation contracts.Operation, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Operation, ports.AdminIdempotencyResult, error)
CreateManagedSubjectCleanup creates or returns the Subject's single durable cleanup Operation.
func (*PostgresControlPlaneStore) CreateManagedTenant ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateManagedTenant( ctx context.Context, tenant contracts.Tenant, idempotency ports.AdminIdempotencyInput, ) (contracts.Tenant, ports.AdminIdempotencyResult, error)
CreateManagedTenant creates or replays one exact operator-owned Tenant response.
func (*PostgresControlPlaneStore) CreateManagedTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateManagedTenantControllerAuthority( ctx context.Context, authority contracts.TenantControllerAuthority, idempotency ports.AdminIdempotencyInput, ) (contracts.TenantControllerCredentialResponse, ports.AdminIdempotencyResult, error)
CreateManagedTenantControllerAuthority creates one idempotency-protected controller credential.
func (*PostgresControlPlaneStore) CreateProfile ¶
func (store *PostgresControlPlaneStore) CreateProfile( ctx context.Context, profile contracts.Profile, idempotency ports.AdminIdempotencyInput, ) (contracts.Profile, ports.AdminIdempotencyResult, error)
func (*PostgresControlPlaneStore) CreateRunnerPool ¶
func (store *PostgresControlPlaneStore) CreateRunnerPool( ctx context.Context, pool contracts.RunnerPool, ) (contracts.RunnerPool, error)
CreateRunnerPool persists one new operator-owned placement boundary and audit event.
func (*PostgresControlPlaneStore) CreateSandbox ¶
func (*PostgresControlPlaneStore) CreateSnapshot ¶
func (store *PostgresControlPlaneStore) CreateSnapshot( ctx context.Context, input ports.SnapshotCreationInput, ) (contracts.Operation, error)
CreateSnapshot admits one asynchronous stopped-Sandbox local clone.
func (*PostgresControlPlaneStore) CreateSubject ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateSubject( ctx context.Context, subject contracts.Subject, ) (contracts.Subject, error)
CreateSubject persists one tenant-scoped subject identity.
func (*PostgresControlPlaneStore) CreateTenant ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateTenant( ctx context.Context, tenant contracts.Tenant, ) (contracts.Tenant, error)
CreateTenant persists one explicit tenant management boundary.
func (*PostgresControlPlaneStore) CreateTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) CreateTenantControllerAuthority( ctx context.Context, authority contracts.TenantControllerAuthority, ) (contracts.TenantControllerCredentialResponse, error)
CreateTenantControllerAuthority generates and persists one tenant-controller credential.
func (*PostgresControlPlaneStore) DeleteSnapshot ¶
func (store *PostgresControlPlaneStore) DeleteSnapshot( ctx context.Context, input ports.SnapshotDeletionInput, ) (contracts.Operation, error)
DeleteSnapshot admits one asynchronous local Snapshot deletion.
func (*PostgresControlPlaneStore) DisableProfile ¶
func (store *PostgresControlPlaneStore) DisableProfile( ctx context.Context, name string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Profile, ports.AdminIdempotencyResult, error)
func (*PostgresControlPlaneStore) GetApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetApplicationAuthority( ctx context.Context, tenantRef string, authorityID string, ) (contracts.ApplicationAuthority, error)
GetApplicationAuthority returns no bearer or verifier material.
func (*PostgresControlPlaneStore) GetDeploymentUsage ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetDeploymentUsage( ctx context.Context, limit int, cursor string, observedAt time.Time, ) (contracts.DeploymentUsage, error)
GetDeploymentUsage returns one repeatable-read deployment aggregate and Tenant page.
func (*PostgresControlPlaneStore) GetLeaseByID ¶
func (store *PostgresControlPlaneStore) GetLeaseByID( ctx context.Context, tenantRef string, subjectRef string, leaseID string, ) (contracts.Lease, error)
GetLeaseByID reads one Lease without accepting a caller-supplied Sandbox scope.
func (*PostgresControlPlaneStore) GetOperation ¶
func (*PostgresControlPlaneStore) GetProfile ¶
func (*PostgresControlPlaneStore) GetRunner ¶
func (store *PostgresControlPlaneStore) GetRunner( ctx context.Context, runnerID string, ) (contracts.Runner, error)
GetRunner returns one administrative runner projection without credential material.
func (*PostgresControlPlaneStore) GetRunnerPool ¶
func (store *PostgresControlPlaneStore) GetRunnerPool( ctx context.Context, name string, ) (contracts.RunnerPool, error)
GetRunnerPool returns one administrative placement boundary.
func (*PostgresControlPlaneStore) GetSandbox ¶
func (*PostgresControlPlaneStore) GetSandboxLifecyclePolicy ¶
func (store *PostgresControlPlaneStore) GetSandboxLifecyclePolicy( ctx context.Context, tenantRef string, subjectRef string, sandboxID string, ) (contracts.LifecyclePolicy, contracts.RetentionPolicy, error)
GetSandboxLifecyclePolicy reads the immutable ProfileRevision pinned by the Sandbox.
func (*PostgresControlPlaneStore) GetSnapshot ¶
func (*PostgresControlPlaneStore) GetSubject ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetSubject(ctx context.Context, tenantRef, subjectRef string) (contracts.Subject, error)
GetSubject returns one non-enumerating tenant-scoped Subject.
func (*PostgresControlPlaneStore) GetSubjectUsage ¶
func (store *PostgresControlPlaneStore) GetSubjectUsage( ctx context.Context, tenantRef string, subjectRef string, ) (contracts.SubjectUsage, error)
GetSubjectUsage reads one subject's current quota and aggregate reservations.
func (*PostgresControlPlaneStore) GetTenant ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetTenant(ctx context.Context, tenantRef string) (contracts.Tenant, error)
GetTenant returns one operator-visible Tenant.
func (*PostgresControlPlaneStore) GetTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetTenantControllerAuthority( ctx context.Context, tenantRef string, authorityID string, ) (contracts.TenantControllerAuthority, error)
GetTenantControllerAuthority returns no bearer or verifier material.
func (*PostgresControlPlaneStore) GetTenantOperation ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetTenantOperation( ctx context.Context, tenantRef string, operationID string, ) (contracts.Operation, error)
GetTenantOperation returns one Operation without accepting a caller-supplied Subject assertion.
func (*PostgresControlPlaneStore) GetTenantUsage ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) GetTenantUsage( ctx context.Context, tenantRef string, limit int, cursor string, observedAt time.Time, ) (contracts.TenantUsage, error)
GetTenantUsage reads one tenant's aggregate and per-Subject quota reservations.
func (*PostgresControlPlaneStore) ListApplicationAuthorities ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) ListApplicationAuthorities(ctx context.Context, tenantRef, subjectRef string, limit int, cursor string) (contracts.ApplicationAuthorityPage, error)
ListApplicationAuthorities returns one stable non-secret tenant-scoped page.
func (*PostgresControlPlaneStore) ListAuditEvents ¶
func (store *PostgresControlPlaneStore) ListAuditEvents( ctx context.Context, tenantRef string, limit int, ) ([]contracts.AuditEvent, error)
func (*PostgresControlPlaneStore) ListProfiles ¶
func (store *PostgresControlPlaneStore) ListProfiles( ctx context.Context, limit int, cursor string, ) (contracts.ProfilePage, error)
func (*PostgresControlPlaneStore) ListRunnerPools ¶
func (store *PostgresControlPlaneStore) ListRunnerPools( ctx context.Context, limit int, cursor string, ) (contracts.RunnerPoolPage, error)
ListRunnerPools returns a bounded stable administrative page.
func (*PostgresControlPlaneStore) ListRunners ¶
func (store *PostgresControlPlaneStore) ListRunners( ctx context.Context, poolName string, limit int, cursor string, ) (contracts.RunnerPage, error)
ListRunners returns stable runner projections optionally filtered by one exact pool.
func (*PostgresControlPlaneStore) ListSandboxes ¶
func (*PostgresControlPlaneStore) ListSnapshots ¶
func (*PostgresControlPlaneStore) ListSubjects ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) ListSubjects(ctx context.Context, tenantRef string, limit int, cursor string) (contracts.SubjectPage, error)
ListSubjects returns one stable tenant-scoped Subject page.
func (*PostgresControlPlaneStore) ListTenantControllerAuthorities ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) ListTenantControllerAuthorities(ctx context.Context, tenantRef string, limit int, cursor string) (contracts.TenantControllerAuthorityPage, error)
ListTenantControllerAuthorities returns one stable tenant-scoped controller page.
func (*PostgresControlPlaneStore) ListTenants ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) ListTenants(ctx context.Context, limit int, cursor string) (contracts.TenantPage, error)
ListTenants returns one stable operator-visible Tenant page.
func (*PostgresControlPlaneStore) OpenActivitySession ¶
func (store *PostgresControlPlaneStore) OpenActivitySession( ctx context.Context, input ports.ActivityInput, ) (contracts.ActivitySession, error)
OpenActivitySession admits one useful generation-bound session.
func (*PostgresControlPlaneStore) Ping ¶
func (store *PostgresControlPlaneStore) Ping(ctx context.Context) error
Ping proves the PostgreSQL authority is reachable.
func (*PostgresControlPlaneStore) PingGuest ¶
func (store *PostgresControlPlaneStore) PingGuest( ctx context.Context, input ports.GenerationInput, liveness string, ) (contracts.Instance, error)
func (*PostgresControlPlaneStore) QueueExpiredSnapshotDelete ¶
func (store *PostgresControlPlaneStore) QueueExpiredSnapshotDelete( ctx context.Context, input ports.SnapshotRetentionInput, ) (bool, error)
QueueExpiredSnapshotDelete admits at most one due retention deletion through the same asynchronous local effect path as an explicit API deletion.
func (*PostgresControlPlaneStore) ReadDeploymentTiming ¶
func (store *PostgresControlPlaneStore) ReadDeploymentTiming( ctx context.Context, since time.Time, until time.Time, ) (contracts.DeploymentTimingSummary, error)
ReadDeploymentTiming returns bounded aggregate database timing evidence.
func (*PostgresControlPlaneStore) ReadEgressContextPreflight ¶ added in v0.8.0
func (store *PostgresControlPlaneStore) ReadEgressContextPreflight(ctx context.Context) (contracts.EgressContextPreflight, error)
ReadEgressContextPreflight compares durable Tenant/Profile requirements with current connected Runner advertisements and groups active assignment impact. It is intentionally read-only.
func (*PostgresControlPlaneStore) ReadMetricsSnapshot ¶
func (store *PostgresControlPlaneStore) ReadMetricsSnapshot( ctx context.Context, ) (contracts.MetricsSnapshot, error)
func (*PostgresControlPlaneStore) ReadOperationTiming ¶
func (store *PostgresControlPlaneStore) ReadOperationTiming( ctx context.Context, tenantRef string, subjectRef string, operationID string, ) (contracts.OperationTiming, error)
ReadOperationTiming returns subject-owned timing evidence for one Operation.
func (*PostgresControlPlaneStore) ReadSandboxInspection ¶
func (store *PostgresControlPlaneStore) ReadSandboxInspection( ctx context.Context, input ports.GenerationInput, ) (contracts.SandboxInspection, error)
ReadSandboxInspection projects current persisted guest and useful-session evidence.
func (*PostgresControlPlaneStore) ReadSandboxTiming ¶
func (store *PostgresControlPlaneStore) ReadSandboxTiming( ctx context.Context, tenantRef string, subjectRef string, sandboxID string, limit int, ) (contracts.SandboxTiming, error)
ReadSandboxTiming returns one explicitly bounded subject-owned timing history.
func (*PostgresControlPlaneStore) RegisterRunnerPool ¶
func (store *PostgresControlPlaneStore) RegisterRunnerPool( ctx context.Context, pool contracts.RunnerPool, ) error
func (*PostgresControlPlaneStore) ReleaseLease ¶
func (store *PostgresControlPlaneStore) ReleaseLease( ctx context.Context, input ports.LeaseInput, ) (contracts.Lease, error)
ReleaseLease revokes activity authority without changing Sandbox desired state.
func (*PostgresControlPlaneStore) RelocateSandbox ¶
func (store *PostgresControlPlaneStore) RelocateSandbox( ctx context.Context, input ports.WorkspaceRelocationInput, ) (contracts.Operation, error)
RelocateSandbox admits one stopped Workspace transfer under its mutation slot.
func (*PostgresControlPlaneStore) RenewLease ¶
func (store *PostgresControlPlaneStore) RenewLease( ctx context.Context, input ports.LeaseInput, ) (contracts.Lease, error)
RenewLease extends only active, unexpired current-generation authority.
func (*PostgresControlPlaneStore) RestoreSnapshot ¶
func (store *PostgresControlPlaneStore) RestoreSnapshot( ctx context.Context, input ports.SnapshotRestoreInput, ) (contracts.Operation, error)
RestoreSnapshot admits the prepare phase of one stopped-Sandbox in-place restore.
func (*PostgresControlPlaneStore) ReviseProfile ¶
func (store *PostgresControlPlaneStore) ReviseProfile( ctx context.Context, name string, revision contracts.ProfileRevision, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Profile, ports.AdminIdempotencyResult, error)
func (*PostgresControlPlaneStore) RevokeApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RevokeApplicationAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, ) (contracts.ApplicationAuthority, error)
RevokeApplicationAuthority immediately denies its bearer credential.
func (*PostgresControlPlaneStore) RevokeManagedApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RevokeManagedApplicationAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.ApplicationAuthority, ports.AdminIdempotencyResult, error)
RevokeManagedApplicationAuthority revokes or replays one application mutation.
func (*PostgresControlPlaneStore) RevokeManagedTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RevokeManagedTenantControllerAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.TenantControllerAuthority, ports.AdminIdempotencyResult, error)
RevokeManagedTenantControllerAuthority revokes or replays one controller mutation.
func (*PostgresControlPlaneStore) RevokeTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RevokeTenantControllerAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, ) (contracts.TenantControllerAuthority, error)
RevokeTenantControllerAuthority immediately denies its bearer credential.
func (*PostgresControlPlaneStore) RotateApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RotateApplicationAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, ) (contracts.ApplicationCredentialResponse, error)
RotateApplicationAuthority invalidates the previous bearer and returns one replacement.
func (*PostgresControlPlaneStore) RotateManagedApplicationAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RotateManagedApplicationAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.ApplicationCredentialResponse, ports.AdminIdempotencyResult, error)
RotateManagedApplicationAuthority performs one idempotency-protected application credential rotation.
func (*PostgresControlPlaneStore) RotateManagedTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RotateManagedTenantControllerAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.TenantControllerCredentialResponse, ports.AdminIdempotencyResult, error)
RotateManagedTenantControllerAuthority performs one idempotency-protected controller credential rotation.
func (*PostgresControlPlaneStore) RotateTenantControllerAuthority ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) RotateTenantControllerAuthority( ctx context.Context, tenantRef string, authorityID string, expectedRevision int64, now time.Time, ) (contracts.TenantControllerCredentialResponse, error)
RotateTenantControllerAuthority invalidates the previous bearer and returns one replacement.
func (*PostgresControlPlaneStore) SetSandboxDesiredState ¶
func (store *PostgresControlPlaneStore) SetSandboxDesiredState( ctx context.Context, input ports.LifecycleIntentInput, ) (contracts.Operation, error)
SetSandboxDesiredState records intent without claiming runner-side completion.
func (*PostgresControlPlaneStore) SetTenantState ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) SetTenantState( ctx context.Context, tenantRef, targetState string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Tenant, ports.AdminIdempotencyResult, error)
SetTenantState applies one revision-fenced Tenant lifecycle transition.
func (*PostgresControlPlaneStore) SweepSessionAccounting ¶ added in v0.2.0
func (store *PostgresControlPlaneStore) SweepSessionAccounting( ctx context.Context, now time.Time, activityRetention time.Duration, limit int, ) (int64, error)
SweepSessionAccounting removes at most limit expired accounting records.
func (*PostgresControlPlaneStore) TouchActivity ¶
func (store *PostgresControlPlaneStore) TouchActivity( ctx context.Context, input ports.ActivityInput, ) (time.Time, error)
TouchActivity records explicit useful activity for the current generation.
func (*PostgresControlPlaneStore) UpdateManagedSubjectQuota ¶ added in v0.6.0
func (store *PostgresControlPlaneStore) UpdateManagedSubjectQuota( ctx context.Context, tenantRef string, subjectRef string, quota contracts.QuotaLimits, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Subject, ports.AdminIdempotencyResult, error)
UpdateManagedSubjectQuota applies one revision-fenced complete quota replacement.
func (*PostgresControlPlaneStore) UpdateManagedTenantEgressContext ¶ added in v0.8.0
func (store *PostgresControlPlaneStore) UpdateManagedTenantEgressContext( ctx context.Context, tenantRef string, egressContext *string, expectedRevision int64, now time.Time, idempotency ports.AdminIdempotencyInput, ) (contracts.Tenant, ports.AdminIdempotencyResult, error)
UpdateManagedTenantEgressContext replaces or clears one operator-owned context.
func (*PostgresControlPlaneStore) UpdateRunnerPool ¶
func (store *PostgresControlPlaneStore) UpdateRunnerPool( ctx context.Context, name string, update contracts.UpdateRunnerPoolRequest, expectedRevision int64, now time.Time, ) (contracts.RunnerPool, error)
UpdateRunnerPool changes explicit scheduling policy under optimistic concurrency.
func (*PostgresControlPlaneStore) UpdateSandboxMetadata ¶
func (store *PostgresControlPlaneStore) UpdateSandboxMetadata( ctx context.Context, input ports.UpdateSandboxMetadataInput, ) (contracts.Sandbox, error)
UpdateSandboxMetadata replaces application correlation metadata under the Sandbox revision fence without changing any lifecycle or runner authority.
Source Files
¶
- interfaces.go
- postgres_activity.go
- postgres_admin_idempotency.go
- postgres_egress_context_diagnostics.go
- postgres_idempotency.go
- postgres_leases.go
- postgres_lifecycle.go
- postgres_list_pagination.go
- postgres_local_workspaces.go
- postgres_management.go
- postgres_relocations.go
- postgres_runner_admin.go
- postgres_runner_placement.go
- postgres_sandbox_metadata.go
- postgres_session_accounting.go
- postgres_snapshots.go
- postgres_store.go
- postgres_timings.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package lifecycleprojection owns PostgreSQL projections shared by durable lifecycle transitions and the runner evidence transactions that establish those transitions' prerequisites.
|
Package lifecycleprojection owns PostgreSQL projections shared by durable lifecycle transitions and the runner evidence transactions that establish those transitions' prerequisites. |
|
Package rowlock owns the invariant PostgreSQL lock order for durable resource mutations.
|
Package rowlock owns the invariant PostgreSQL lock order for durable resource mutations. |