Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
Package postgres implements the shared PostgreSQL control-plane core. Declarative profiles own extension and configuration policy; wrapper hooks compose application readiness and relay targets without duplicating lifecycle.
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
Index ¶
- func BindingContext(ctx context.Context) context.Context
- func BindingSourceRevision(c *domain.Cluster) (string, error)
- func PrepareCommands(version string) []string
- type Access
- type CitusOptions
- type Core
- func (*Core) ApplyDefaults(s *domain.ClusterSpec)
- func (*Core) Balancer(context.Context, *engine.Context) (domain.BalancerStatus, error)
- func (p *Core) BindingEndpoint(ctx context.Context, rc *engine.Context) (string, []byte, error)
- func (*Core) CanCancelOperation(_ context.Context, op *domain.Operation) error
- func (*Core) CanClaimOperation(c *domain.Cluster) (bool, error)
- func (p *Core) CancelOperation(ctx context.Context, rc *engine.Context, op *domain.Operation) (engine.OpResult, error)
- func (p *Core) Cleanup(ctx context.Context, rc *engine.Context, opts domain.DeleteOptions) (done bool, err error)
- func (p *Core) Connection(ctx context.Context, rc *engine.Context) (domain.ConnectionDetails, error)
- func (p *Core) CreateDatabase(ctx context.Context, rc *engine.Context, v Database) error
- func (*Core) CreateDatabaseRole(context.Context, *engine.Context, domain.DatabaseRole) error
- func (*Core) CreateDatabaseUser(context.Context, *engine.Context, domain.DatabaseUser, string) (string, error)
- func (p *Core) CreateRole(ctx context.Context, rc *engine.Context, v RoleWrite) (string, error)
- func (p *Core) DataAccessCredentials(ctx context.Context, rc *engine.Context, level engine.DataAccessLevel) (engine.DataAccessCredentials, error)
- func (*Core) DataMcp(c *domain.Cluster) (engine.DataMcpBackend, error)
- func (*Core) DataMembers(c *domain.Cluster) []string
- func (p *Core) DeleteDatabase(ctx context.Context, rc *engine.Context, name string, force bool) error
- func (*Core) DeleteDatabaseRole(context.Context, *engine.Context, string, string) error
- func (*Core) DeleteDatabaseUser(context.Context, *engine.Context, string, string) error
- func (p *Core) DeleteRetainedBackup(ctx context.Context, storage domain.BackupStorage, b domain.Backup) error
- func (p *Core) DeleteRole(ctx context.Context, rc *engine.Context, name string) error
- func (p *Core) Describe() domain.ProviderInfo
- func (p *Core) EnqueueFullBackup(ctx context.Context, rc *engine.Context, key string) error
- func (p *Core) EnsureBindingRole(ctx context.Context, rc *engine.Context, name string, limit int) error
- func (p *Core) EnsureDatabaseExtensions(ctx context.Context, rc *engine.Context, v Database) error
- func (p *Core) EnsureStanza(ctx context.Context, rc *engine.Context, upgrade bool) error
- func (p *Core) FilterRetention(backups, candidates []domain.Backup) []domain.Backup
- func (p *Core) GetDatabase(ctx context.Context, rc *engine.Context, name string) (*Database, error)
- func (*Core) GetDatabaseRole(context.Context, *engine.Context, string, string) (*domain.DatabaseRole, error)
- func (*Core) GetDatabaseUser(context.Context, *engine.Context, string, string) (*domain.DatabaseUser, error)
- func (p *Core) GetRole(ctx context.Context, rc *engine.Context, name string) (*Role, error)
- func (p *Core) Grant(ctx context.Context, rc *engine.Context, v Grant) error
- func (p *Core) InitialDataSourceApplied(c *domain.Cluster) (bool, error)
- func (*Core) InitialDataSourceRecoveryPending(c *domain.Cluster) (bool, error)
- func (*Core) ListDatabaseRoles(context.Context, *engine.Context) ([]domain.DatabaseRole, error)
- func (*Core) ListDatabaseUsers(context.Context, *engine.Context) ([]domain.DatabaseUser, error)
- func (p *Core) ListDatabases(ctx context.Context, rc *engine.Context) ([]Database, error)
- func (p *Core) ListGrants(ctx context.Context, rc *engine.Context, database string) ([]Grant, error)
- func (p *Core) ListRoles(ctx context.Context, rc *engine.Context) ([]Role, error)
- func (p *Core) MemberConfig(ctx context.Context, rc *engine.Context, name string) (agentapi.MemberConfig, error)
- func (*Core) MemberLogs(ctx context.Context, rc *engine.Context, name, process string, lines int) ([]domain.MemberLogLine, error)
- func (*Core) Metrics() []domain.MetricDescriptor
- func (p *Core) MigrateInitialDataSource(ctx context.Context, rc *engine.Context) error
- func (*Core) Name() string
- func (p *Core) OwnBindingDatabase(ctx context.Context, rc *engine.Context, db Database) error
- func (p *Core) PITRWindow(ctx context.Context, rc *engine.Context) ([]domain.TimeWindow, error)
- func (p *Core) Placement(ctx context.Context, rc *engine.Context) (domain.Placement, error)
- func (p *Core) ProjectCredentialsStatus(ctx context.Context, rc *engine.Context, status domain.ClusterStatus) domain.ClusterStatus
- func (p *Core) RelayTargets(c *domain.Cluster) []string
- func (*Core) RequiredCapabilities(s domain.ClusterSpec) []string
- func (p *Core) Revoke(ctx context.Context, rc *engine.Context, v Grant) error
- func (p *Core) RotateRolePassword(ctx context.Context, rc *engine.Context, name string) (string, error)
- func (p *Core) RunOperation(ctx context.Context, rc *engine.Context, op *domain.Operation) (result engine.OpResult, err error)
- func (*Core) SetBalancer(context.Context, *engine.Context, bool) error
- func (p *Core) Status(ctx context.Context, rc *engine.Context) (status domain.ClusterStatus, statusErr error)
- func (*Core) SupportsFailureCleanup(op *domain.Operation) bool
- func (p *Core) Sync(ctx context.Context, rc *engine.Context) (result engine.Result, err error)
- func (*Core) SyncDuringOperation(op *domain.Operation) bool
- func (*Core) SystemUsers(_ context.Context, rc *engine.Context) ([]domain.SystemUser, error)
- func (*Core) UpdateDatabaseRole(context.Context, *engine.Context, domain.DatabaseRole) error
- func (*Core) UpdateDatabaseUser(context.Context, *engine.Context, domain.DatabaseUser, string) error
- func (p *Core) UpdateRole(ctx context.Context, rc *engine.Context, v RoleWrite) error
- func (p *Core) Validate(ctx context.Context, old, n *domain.Cluster) error
- func (*Core) ValidateDatabasePassword(v string) error
- func (*Core) ValidateMemberReplacement(c *domain.Cluster, name string) error
- func (p *Core) ValidatePITRRestore(ctx context.Context, rc *engine.Context, target time.Time) ([]domain.TimeWindow, error)
- func (p *Core) VerifyBindingRole(ctx context.Context, rc *engine.Context, name string) (uint32, error)
- func (*Core) VolumeReferences(c *domain.Cluster) ([]engine.VolumeReference, error)
- type Database
- type EngineOptions
- type Flavour
- type Grant
- type Options
- type ProxyOptions
- type Role
- type RoleWrite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindingContext ¶ added in v0.4.0
BindingContext grants the trusted in-process binding controller access to the reserved kb_ role namespace. Public API handlers never use this scope.
func BindingSourceRevision ¶ added in v0.4.0
BindingSourceRevision fences cached database repairs across every managed restore, including restores requested outside the binding service. Do not publish a successful repair while recovery can still replace native ACLs.
func PrepareCommands ¶
PrepareCommands installs only pinned native packages and suppresses distro daemons.
Types ¶
type Access ¶
type Access interface {
ListRoles(context.Context, *engine.Context) ([]Role, error)
GetRole(context.Context, *engine.Context, string) (*Role, error)
CreateRole(context.Context, *engine.Context, RoleWrite) (string, error)
UpdateRole(context.Context, *engine.Context, RoleWrite) error
DeleteRole(context.Context, *engine.Context, string) error
RotateRolePassword(context.Context, *engine.Context, string) (string, error)
ListDatabases(context.Context, *engine.Context) ([]Database, error)
GetDatabase(context.Context, *engine.Context, string) (*Database, error)
CreateDatabase(context.Context, *engine.Context, Database) error
DeleteDatabase(context.Context, *engine.Context, string, bool) error
ListGrants(context.Context, *engine.Context, string) ([]Grant, error)
Grant(context.Context, *engine.Context, Grant) error
Revoke(context.Context, *engine.Context, Grant) error
}
Access is shared by PostgreSQL and providers embedding its core.
type CitusOptions ¶ added in v0.4.0
type CitusOptions struct {
WorkerGroups int `json:"workerGroups"`
Database string `json:"database"`
}
CitusOptions controls formation membership, not members per replication group.
func (*CitusOptions) UnmarshalJSON ¶ added in v0.4.0
func (o *CitusOptions) UnmarshalJSON(raw []byte) error
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core reconciles the PostgreSQL data plane and its stateless proxy.
func (*Core) ApplyDefaults ¶
func (*Core) ApplyDefaults(s *domain.ClusterSpec)
func (*Core) BindingEndpoint ¶ added in v0.4.0
BindingEndpoint resolves private writer discovery without revealing system credentials.
func (*Core) CanCancelOperation ¶
func (*Core) CanClaimOperation ¶
CanClaimOperation leaves Sync-owned maintenance ahead of queued imperative work: upgrades, directional restarts and terminal replacement recovery.
func (*Core) CancelOperation ¶
func (*Core) Cleanup ¶
func (p *Core) Cleanup(ctx context.Context, rc *engine.Context, opts domain.DeleteOptions) (done bool, err error)
Cleanup removes owned infrastructure, retaining data and credentials on suspension.
func (*Core) Connection ¶
func (*Core) CreateDatabase ¶
func (*Core) CreateDatabaseRole ¶
func (*Core) CreateDatabaseUser ¶
func (*Core) CreateRole ¶
func (*Core) DataAccessCredentials ¶ added in v0.3.0
func (p *Core) DataAccessCredentials(ctx context.Context, rc *engine.Context, level engine.DataAccessLevel) (engine.DataAccessCredentials, error)
DataAccessCredentials uses direct project-network member DNS, never proxies or public endpoints: the companion requires PostgreSQL's full extended protocol. Multi-host URIs prefer a standby for reads and require a writer for RW. PUBLIC CONNECT/object grants remain inherited PostgreSQL privileges: database scoping is not an isolation boundary for objects already readable by PUBLIC.
func (*Core) DataMembers ¶
DataMembers returns active data identities in allocation order. Credentials remain available only through the authenticated MemberConfig path.
func (*Core) DeleteDatabase ¶
func (*Core) DeleteDatabaseRole ¶
func (*Core) DeleteDatabaseUser ¶
func (*Core) DeleteRetainedBackup ¶
func (p *Core) DeleteRetainedBackup(ctx context.Context, storage domain.BackupStorage, b domain.Backup) error
DeleteRetainedBackup expires a repository set with no remaining live writer. Supabase promotes this method unchanged through the PostgreSQL core.
func (*Core) DeleteRole ¶
func (*Core) Describe ¶
func (p *Core) Describe() domain.ProviderInfo
func (*Core) EnqueueFullBackup ¶
EnqueueFullBackup atomically queues a deterministic fresh base. Repeating the same key after a crash does not create a second backup or operation.
func (*Core) EnsureBindingRole ¶ added in v0.4.0
func (p *Core) EnsureBindingRole(ctx context.Context, rc *engine.Context, name string, limit int) error
EnsureBindingRole recovers only roles whose creation was published by our credential journal. A matching native name alone is never ownership evidence.
func (*Core) EnsureDatabaseExtensions ¶ added in v0.4.0
EnsureDatabaseExtensions resumes extension creation on an existing database, refusing to adopt a database owned by a different role.
func (*Core) EnsureStanza ¶
EnsureStanza creates the configured repository's stanza, or upgrades its database history after a major upgrade. Both actions are idempotent.
func (*Core) FilterRetention ¶
FilterRetention preserves pgBackRest's newest full and any chain needed by backups retained by another schedule (or created manually). Skipped sets stay eligible on later passes, once a newer full and independent retained sets exist.
func (*Core) GetDatabase ¶
func (*Core) GetDatabaseRole ¶
func (*Core) GetDatabaseUser ¶
func (*Core) InitialDataSourceApplied ¶
func (*Core) InitialDataSourceRecoveryPending ¶
func (*Core) ListDatabaseRoles ¶
func (*Core) ListDatabaseUsers ¶
func (*Core) ListDatabases ¶
func (*Core) ListGrants ¶
func (*Core) MemberConfig ¶
func (p *Core) MemberConfig(ctx context.Context, rc *engine.Context, name string) (agentapi.MemberConfig, error)
MemberConfig renders secret-bearing configuration only for an allocated member.
func (*Core) MemberLogs ¶
func (*Core) Metrics ¶
func (*Core) Metrics() []domain.MetricDescriptor
Metrics maps the native runner's stable vocabulary into canonical series.
func (*Core) MigrateInitialDataSource ¶
MigrateInitialDataSource accepts a completed pre-marker recovery receipt, not its (possibly superseded) create tracker. No source/native I/O is replayed.
func (*Core) OwnBindingDatabase ¶ added in v0.4.0
OwnBindingDatabase repairs a binding-owned database's public schema ownership and CONNECT/TEMPORARY privileges; it cannot change database ownership.
func (*Core) PITRWindow ¶
PITRWindow reports a deliberately conservative observable interval, not WAL filename timestamps or a promise that an external actor has not removed WAL.
func (*Core) ProjectCredentialsStatus ¶
func (p *Core) ProjectCredentialsStatus(ctx context.Context, rc *engine.Context, status domain.ClusterStatus) domain.ClusterStatus
ProjectCredentialsStatus fences cached publication observations against access mutations completed since the last reconciliation.
func (*Core) RequiredCapabilities ¶
func (*Core) RequiredCapabilities(s domain.ClusterSpec) []string
func (*Core) RotateRolePassword ¶
func (*Core) RunOperation ¶
func (p *Core) RunOperation(ctx context.Context, rc *engine.Context, op *domain.Operation) (result engine.OpResult, err error)
RunOperation executes bounded, checkpointed rolling restarts.
func (*Core) SupportsFailureCleanup ¶
Failure cleanup hands a durable recovery owner to Sync. Once retirement has started, completing that same cutover is safer than trying to undo stop holds or an etcd removal whose response may have been lost.
func (*Core) SyncDuringOperation ¶
SyncDuringOperation permits provisioning only while a replacement joins. Maintenance operations must retain exclusive ownership of the data plane.
func (*Core) SystemUsers ¶
func (*Core) UpdateDatabaseRole ¶
func (*Core) UpdateDatabaseUser ¶
func (*Core) UpdateRole ¶
func (*Core) ValidateDatabasePassword ¶
func (*Core) ValidateMemberReplacement ¶ added in v0.4.0
ValidateMemberReplacement is also promoted by the Supabase provider.
func (*Core) ValidatePITRRestore ¶
func (*Core) VerifyBindingRole ¶ added in v0.4.0
func (p *Core) VerifyBindingRole(ctx context.Context, rc *engine.Context, name string) (uint32, error)
VerifyBindingRole checks ownership before cleanup touches dependent objects.
func (*Core) VolumeReferences ¶ added in v0.4.1
VolumeReferences exposes persistent identities for backend sizing observation.
type EngineOptions ¶
type EngineOptions struct {
SynchronousMode string `json:"synchronousMode,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"`
Proxy ProxyOptions `json:"proxy,omitempty"`
Profiles []string `json:"profiles,omitempty"`
Citus *CitusOptions `json:"citus,omitempty"`
}
EngineOptions contains the safe user-controlled PostgreSQL settings.
func ParseOptions ¶
func ParseOptions(raw json.RawMessage) (EngineOptions, error)
ParseOptions rejects unknown fields and parameters that escape engine ownership.
type Flavour ¶
type Flavour interface {
Name() string
PostReady(context.Context, *engine.Context) error
RelayTargets(*domain.Cluster) []string
}
Flavour customizes data members without duplicating their lifecycle.
type Options ¶
type Options struct {
ControlPlaneURL, InternalCAPEM string
Store engine.ClusterStore
Logger *slog.Logger
Flavour Flavour
// ReservedRole extends the immutable system-role set for a composed engine.
ReservedRole func(string) bool
// AvailableExtensions is the admission authority for database extension requests.
// Nil uses the conservative Percona contrib baseline.
AvailableExtensions func(context.Context, *engine.Context) ([]string, error)
// ProfileExtensions lists extensions to update after a version upgrade.
ProfileExtensions func(*engine.Context) []string
}
Options supplies namespace-independent provider dependencies.
type ProxyOptions ¶
Source Files
¶
- access.go
- access_journal.go
- agent_upgrade.go
- agent_upgrade_barrier.go
- backup.go
- backup_cleanup.go
- backup_validation.go
- binding.go
- citus_backup.go
- citus_backup_cleanup.go
- citus_points.go
- citus_rebalance.go
- citus_restore.go
- citus_scale.go
- citus_topology.go
- cleanup.go
- config.go
- datamcp.go
- datamcp_rotation.go
- dataplane.go
- extensions.go
- groups.go
- health.go
- maintenance.go
- membership.go
- metrics.go
- native_certificate_recovery.go
- observation.go
- operations.go
- options.go
- profiles.go
- provider.go
- proxy.go
- proxy_capacity.go
- proxy_clock_recovery.go
- proxy_diagnostics.go
- recovery_access.go
- replacement.go
- resource_recovery.go
- restore.go
- restore_inventory.go
- restore_recovery.go
- retire.go
- retirement.go
- rolling.go
- runtime_recovery.go
- scale_unplaced.go
- secrets.go
- state.go
- status.go
- sync.go
- upgrade.go
- upgrade_replicas.go
- volume_sizes.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pgprofile is the shared availability and curated SQL authority for PostgreSQL profiles.
|
Package pgprofile is the shared availability and curated SQL authority for PostgreSQL profiles. |
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors |