postgres

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package postgres provides the durable PostgreSQL adapter for the control-plane contract.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStore   = errors.New("invalid control-plane PostgreSQL store")
	ErrStateNotFound  = controlplane.ErrStateNotFound
	ErrCommitConflict = errors.New("control-plane commit conflicts with an existing tuple")
	ErrStaleCommit    = errors.New("control-plane commit is stale")
	ErrSequenceGap    = errors.New("control-plane commit has a revision gap")
	ErrWritesFrozen   = errors.New("control-plane writes are frozen")
)

Functions

This section is empty.

Types

type Store

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

func New

func New(db *sql.DB) (*Store, error)

func Open

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

func (*Store) AppendCommit

func (s *Store) AppendCommit(ctx context.Context, commit controlplane.Commit) error

func (*Store) Backend

func (s *Store) Backend() string

Backend identifies this adapter for the production startup contract.

func (*Store) CheckpointLeadership

func (s *Store) CheckpointLeadership(ctx context.Context, next controlplane.State) error

CheckpointLeadership persists a metadata-only leader/term/epoch transition after native-raft has proven that the desired revision and nonce history are unchanged. It never writes a new desired-state commit and therefore cannot be used to bypass normal proposal sequencing.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Health

func (s *Store) Health(ctx context.Context) error

Health verifies that the PostgreSQL connection is usable before startup reads the control-plane snapshot.

func (*Store) LoadState

func (s *Store) LoadState(ctx context.Context, clusterID string) (controlplane.State, error)

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

func (*Store) Prepare

func (s *Store) Prepare(ctx context.Context) error

Prepare performs the idempotent control-plane schema migration required before a durable snapshot is loaded.

Jump to

Keyboard shortcuts

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