Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlstore

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

README

sqlstore

internal/sqlstore owns Starport's relational storage contract. It is the SQL twin of internal/storage, and the two packages pair the same way:

State Embedded (single node) Connect (multi-node)
Key-value Badger Valkey
Relational SQLite (pure Go, no cgo) PostgreSQL or MySQL

A single-node deployment gets a real database with no extra process. The embedded SQLite file lives at data/sqlite/starport.db beside the Badger directory. The development runtime keeps it in memory. When a deployment scales past one gateway, the operator points every node at one shared server, and nothing above this package changes.

Selection

Configuration selects the store:

STARPORT_STORAGE_SQL_MODE=sqlite          # default; SQLITE_PATH selects the file
STARPORT_STORAGE_SQL_MODE=postgres
STARPORT_STORAGE_SQL_POSTGRES_URL=postgres://starport@db.example:5432/starport
STARPORT_STORAGE_SQL_MODE=mysql
STARPORT_STORAGE_SQL_MYSQL_DSN='starport@tcp(db.example:3306)/starport'

Open validates the configuration, dispatches on the type, and for the network backends proves the server answers before returning. Repositories read and write through database/sql on the returned DB. Dialect() names the engine for a statement that needs backend-specific syntax.

Schema

This package owns every migration. A migration is one .sql file named NNNN_description.sql under migrations/<dialect>/. The three files with one name represent the same logical migration. Each dialect uses its own syntax. MySQL cannot index an unbounded TEXT column or parse ON CONFLICT. Migrate applies the dialect's files in name order, once each, and records what it applied. A test holds the three dialect sets to the same file names, and the shared contract tests hold every backend to the same resulting behavior.

SQLite owns each migration through BEGIN IMMEDIATE. PostgreSQL and MySQL hold a session lock on one connection. History checks, schema changes, and completion records share that ownership. Startup rejects unknown migration history.

MySQL can commit DDL before the migration completion record. The runner stores an intent before each attempt and blocks automatic retry after interruption. ReconcileMySQLMigration records an administrator's independently verified applied or reverted outcome. It binds the decision to the migration digest, operator identity, operation ID, and evidence digest. It never repairs schema or repeats uncertain statements itself.

After manual repair, the operation commits its audit record, completion state, and intent removal together. An exact operation retry returns the original result. Reusing an operation ID with different evidence fails. The caller authenticates the administrator and retains the evidence bytes.

SQLite snapshots

SnapshotSQLite uses VACUUM INTO to capture committed data, including records that remain in the WAL. It validates the database and migration history before publishing a new private directory. The directory contains starport.db, snapshot.json, and private publication metadata. Existing destinations remain untouched.

RestoreSQLiteSnapshot checks the manifest's size and SHA256 digest before importing the database. It rejects corrupt images, invalid foreign keys, and unknown or incomplete migration history. It preserves older, contiguous migration history without applying new schema files.

These methods copy SQL state only. They do not select the database for a running gateway or approve restored permissions. The deployment coordinator must stop cross-store writes before backup. Before admission, it must fence old writers and reconcile independent revocation and spending evidence. The full KV, SQL, blob, configuration, and key-access procedure remains part of CSP13.

Relational transfer

SnapshotRelational exports SQLite, PostgreSQL, or MySQL records into a portable SQLite image. It reads one consistent SQL snapshot and preserves the audit ID allocation counter. The transfer uses the current complete migration set. Unknown tables, columns, triggers, and pending migration attempts stop export. Use a dedicated PostgreSQL schema or MySQL database for this procedure.

ImportRelational verifies the image in private staging before writing the target. The target must contain only the current schema and its initial metadata. The caller must fence target writers and stop schema changes first. Concurrent imports share migration ownership, so only one can fill the target.

The caller supplies a required recovery callback. It must close restored permission gates in the same transaction as the imported records. A callback failure rolls back the records. A successful import does not select the target for a running gateway or approve recovery.

Migration 0012 retains migration repair records on every backend. It also gives MySQL migration timestamps microsecond precision to preserve PostgreSQL values. Finer timestamps fail transfer to network SQL. MySQL limits and collation still apply. Incompatible keys or oversized values stop import without partial records.

Native audit counters retain their previous upper bound, including deleted IDs. A failed import can leave an allocation gap on MySQL. Retry preserves that counter instead of resetting it. Transfer never resets the retained allocation floor.

MySQL cannot preserve an exhausted signed audit counter. Import refuses that target before copying records. SQLite and PostgreSQL retain the exhausted state.

Import activation

ReconcileRelationalImport applies one domain repair while the exact import barrier remains present. It commits the repair and its evidence receipt in one transaction under native migration ownership. The callback must use the supplied connection and keep admission closed. An exact retry verifies the receipt without repeating the repair. The domain owner must also check the resulting current state. Changed evidence, another import, or completed activation causes refusal.

ActivateRelationalImport binds a prepared import to its snapshot, operation, restriction policy, and accepted recovery decision digest. It runs the domain approval callback, retains completion receipts, and removes the import barrier in one transaction. The callback must use the supplied connection for SQL writes. It must not commit the transaction or change the schema. The recovery coordinator must first verify independent history, external fencing, and other component releases.

A failed callback rolls back SQL approval and retains the barrier. An exact retry verifies completion without repeating approval or changing later records. A changed decision or import identity causes refusal. Historical receipts survive later backups and imports. Import clears the former native completion marker, so those receipts cannot approve the new deployment.

Tests

go test ./internal/sqlstore/... always proves the embedded backend. The network backends join the same contract suite when the environment names a server, following the Valkey precedent:

TEST_POSTGRES_URL=postgres://starport@127.0.0.1:5432/starport_test \
TEST_MYSQL_DSN='starport@tcp(127.0.0.1:3306)/starport_test' \
go test ./internal/sqlstore/...

Credentials use the URL or DSN fields. The examples omit them.

The qualified release is PostgreSQL 16.15. QualifiedPostgreSQLVersion names it, CI pins the same release by image digest, and TestQualifiedPostgreSQLVersion compares a real service against it. Another release is UNVERIFIED until a qualification run records it.

The suite creates a separate PostgreSQL schema or MySQL database for each contract test. Use disposable services. PostgreSQL credentials must permit schema creation and removal. MySQL credentials must permit database creation and removal. Cleanup removes only the namespaces that the test created.

Documentation

Overview

Package sqlstore owns Starport's relational storage contract. It is the SQL twin of internal/storage: where that package pairs an embedded Badger store with a Valkey connect for shared state, this one pairs an embedded SQLite database that rides the binary with a network SQL connect for a multi-node deployment. Relational concepts — identity, teams, grants, account templates — keep their repositories on this contract and never name a driver or a dialect themselves.

The embedded backend uses a pure-Go SQLite driver, so the single-binary install story holds: no cgo, no system library, no separate database process. The package also owns the schema: every migration lives in the embedded migrations directory here, and Migrate applies them in order, once each, recording what it applied. No other package writes schema.

Index

Constants

View Source
const (
	// TypeSQLite is the embedded backend: a database file beside the
	// deployment's other data, created on first open. An empty path keeps
	// the database in memory, which is the development runtime's choice.
	TypeSQLite = "sqlite"
	// TypePostgres is the PostgreSQL connect for a multi-node deployment,
	// the relational counterpart of the Valkey connect.
	TypePostgres = "postgres"
	// TypeMySQL is the MySQL connect for a multi-node deployment.
	TypeMySQL = "mysql"
)

Relational backend type constants.

View Source
const QualifiedPostgreSQLVersion = "16.15"

QualifiedPostgreSQLVersion is the PostgreSQL release that the real-backend qualification covers. CI pins the same release by image digest, and TestQualifiedPostgreSQLVersion compares a real service against it. Another release is UNVERIFIED until a qualification run records it here.

Variables

View Source
var (
	// ErrUnknownType is returned when the configuration names a backend
	// this package does not serve.
	ErrUnknownType = errors.New("unknown sqlstore type")
	// ErrClosed is returned when an operation reaches a closed store.
	ErrClosed = errors.New("sqlstore closed")
	// ErrSchemaBehind is returned when a store lacks a migration of this binary.
	ErrSchemaBehind = errors.New("relational schema is behind this binary")
)

Common errors returned by sqlstore operations.

View Source
var ErrAuditCounterUnrepresentable = errors.New("MySQL cannot preserve an exhausted audit allocation counter")

ErrAuditCounterUnrepresentable refuses a target that could reuse an exhausted audit ID.

View Source
var ErrGuardDeadline = errors.New("relational import guard requires a context deadline")

ErrGuardDeadline refuses an import guard without a context deadline.

View Source
var ErrImportRestricted = errors.New("relational import requires deployment recovery before startup")

ErrImportRestricted keeps an imported SQL database unavailable to ordinary startup.

View Source
var ErrMigrationRecoveryRequired = errors.New("SQL migration requires reconciliation")

ErrMigrationRecoveryRequired reports a MySQL migration with uncertain schema changes.

View Source
var ErrNotFresh = errors.New("storage is not fresh; use the migration or recovery procedure")

ErrNotFresh refuses initialization over existing or uncertain application state.

View Source
var ErrPopulatedBackend = errors.New("populated relational claim requires PostgreSQL or MySQL")

ErrPopulatedBackend refuses a populated claim on a backend without in-place adoption.

View Source
var ErrPopulatedCensus = errors.New("live relational rows differ from the captured recovery census")

ErrPopulatedCensus refuses a populated claim when the live rows differ from the captured census.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type     string         `env:"TYPE,default=sqlite"`
	SQLite   SQLiteConfig   `env:",prefix=SQLITE_"`
	Postgres PostgresConfig `env:",prefix=POSTGRES_"`
	MySQL    MySQLConfig    `env:",prefix=MYSQL_"`
}

Config selects and configures a relational backend, the way storage.Config selects a key-value one.

func (Config) Validate

func (c Config) Validate() error

Validate reports a configuration this package cannot open.

type DB

type DB struct {
	*sql.DB
	// contains filtered or unexported fields
}

DB is one open relational store. It embeds the standard connection pool, so a repository reads and writes through database/sql, and it names the dialect for the rare statement that cannot be written once for every backend.

func Open

func Open(config Config) (*DB, error)

Open creates a relational store from the configuration. It follows the Go convention internal/storage.Open set: validate, then dispatch on the type.

func (*DB) ActivateRelationalImport added in v1.3.0

func (db *DB) ActivateRelationalImport(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, decisionSHA256 string, approve func(context.Context, *sql.Conn) error) (resultErr error)

ActivateRelationalImport commits final domain approval, its receipt, and import barrier removal together. The coordinator must first verify history and fencing. approve must use only conn for SQL writes and must not commit or change schema. Exact retries verify completion without repeating approval or changing later data.

func (*DB) ActivateRelationalImportAt added in v1.3.0

func (db *DB) ActivateRelationalImportAt(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, position RelationalReplayPosition, decisionSHA256 string, approve func(context.Context, *sql.Conn) error) error

ActivateRelationalImportAt binds barrier release to the exact final replay position. The transaction checks the retained cursor before and after the approval callback. Exact retries preserve later SQL changes without repeating the callback.

func (*DB) Bind

func (db *DB) Bind(query string) string

Bind rewrites ? placeholders into the dialect's form. PostgreSQL numbers its placeholders. The other engines take ? as written. A repository on this contract writes its statements once with ? and binds per dialect.

func (*DB) CheckActivatedRelationalImportAt added in v1.3.0

func (db *DB) CheckActivatedRelationalImportAt(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, position RelationalReplayPosition, decisionSHA256 string) error

CheckActivatedRelationalImportAt verifies the exact retained native activation. It does not approve admission. It preserves all later domain changes and withdrawals.

func (*DB) CheckFresh added in v1.3.0

func (db *DB) CheckFresh(ctx context.Context) error

CheckFresh refuses existing application records before schema migration.

func (*DB) CheckImportBarrier added in v1.3.0

func (db *DB) CheckImportBarrier(ctx context.Context) error

CheckImportBarrier refuses a partial or unapproved SQL restore after schema initialization. Malformed markers also refuse startup. This method never approves or removes a barrier.

func (*DB) CheckRelationalImportPosition added in v1.3.0

func (db *DB) CheckRelationalImportPosition(ctx context.Context, original SQLiteSnapshot, identity RelationalImportIdentity, position RelationalReplayPosition) (resultErr error)

CheckRelationalImportPosition verifies current closed ownership without changing state. It does not prove external fencing or complete independent history.

func (*DB) CheckSchemaCurrent added in v1.3.0

func (db *DB) CheckSchemaCurrent(ctx context.Context) error

CheckSchemaCurrent refuses a store that lacks an embedded migration or that records a migration this binary does not know. It changes nothing, so a write path can refuse instead of migrating.

func (*DB) CheckUnreleasedRelationalImport added in v1.3.0

func (db *DB) CheckUnreleasedRelationalImport(ctx context.Context, original SQLiteSnapshot, identity RelationalImportIdentity) (resultErr error)

CheckUnreleasedRelationalImport verifies the original closed claim at any replay position. It creates no record and never releases or repairs an import barrier.

func (*DB) ClaimPopulatedRelational added in v1.3.0

func (db *DB) ClaimPopulatedRelational(ctx context.Context, expected SQLiteSnapshot, census RelationalRecoveryCensus, scratch string, identity RelationalImportIdentity, restrict func(context.Context, *sql.Conn) error) (resultErr error)

ClaimPopulatedRelational installs the import barrier on a populated PostgreSQL or MySQL database in place. The live rows must equal the captured census of expected in every class. The claim copies no rows. It retires the current activation and replay rows, keeps every historical receipt, and writes one closure receipt. restrict runs in the same transaction. Exact retries verify the closure receipt and do not repeat restrict. Scratch must be an existing private directory. The caller must fence every target writer.

func (*DB) Dialect

func (db *DB) Dialect() string

Dialect names the SQL dialect this store speaks: one of the Type constants.

func (*DB) GuardRelationalImport added in v1.3.0

func (db *DB) GuardRelationalImport(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, position RelationalReplayPosition, callback func(context.Context, *sql.Conn) error) (resultErr error)

GuardRelationalImport holds native migration ownership and a transaction at an exact closed import position. The callback must use only conn for SQL work, without a nested transaction, commit, or schema change. The caller must bound non-SQL work by the context deadline and retain receipts for independent commits. A returned error does not undo an independent KV commit or prove that SQL completion failed. This guard never advances replay or removes the import barrier.

func (*DB) ImportRelational added in v1.3.0

func (db *DB) ImportRelational(ctx context.Context, source string, expected SQLiteSnapshot, scratch string, restrict func(context.Context, *sql.Conn) error) (resultErr error)

ImportRelational copies a verified image into an empty, migrated target database. The caller must fence every target writer and stop schema changes before import. restrict must close restored permission gates in the same transaction before commit. This operation does not change application configuration or approve recovery.

func (*DB) ImportRelationalOnce added in v1.3.0

func (db *DB) ImportRelationalOnce(ctx context.Context, source string, expected SQLiteSnapshot, scratch string, identity RelationalImportIdentity, restrict func(context.Context, *sql.Conn) error) error

ImportRelationalOnce retains a startup barrier in the same transaction as imported records. Exact retries validate the source and receipt without repeating restrictions. The caller must fence target writers. A receipt does not verify later target mutations.

func (*DB) Migrate

func (db *DB) Migrate(ctx context.Context) error

Migrate applies pending schema files under database migration ownership. SQLite and PostgreSQL commit each file with its completion record. MySQL retains an intent before DDL and refuses automatic retries after partial failure.

func (*DB) Ping

func (db *DB) Ping(ctx context.Context) error

Ping reports whether the store is reachable, bounded by the context.

func (*DB) PrepareImportSchema added in v1.3.0

func (db *DB) PrepareImportSchema(ctx context.Context) error

PrepareImportSchema initializes empty target tables or accepts a current schema. It never upgrades populated state. All writers and other schema owners must remain fenced. The importer separately checks emptiness or the exact retained import receipt.

func (*DB) ReconcileMySQLMigration added in v1.3.0

func (db *DB) ReconcileMySQLMigration(ctx context.Context, decision MigrationReconciliation) error

ReconcileMySQLMigration records verified repair without executing migration SQL. The operator must first establish the declared outcome from the schema and data. An exact operation retry is idempotent. Changed decisions require another operation ID.

func (*DB) ReconcileRelationalImport added in v1.3.0

func (db *DB) ReconcileRelationalImport(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, step, evidenceSHA256 string, apply func(context.Context, *sql.Conn) error) (resultErr error)

ReconcileRelationalImport commits one domain repair and its immutable receipt. It requires the exact import barrier and retains that barrier after success. apply must use conn without committing, changing schema, or opening admission. The owner must validate current domain state after an exact receipt retry.

func (*DB) RecoveryTargetSHA256 added in v1.3.0

func (db *DB) RecoveryTargetSHA256(ctx context.Context, config Config) (string, error)

RecoveryTargetSHA256 binds connection routes and the selected database namespace. It excludes credentials and does not prove physical server continuity.

func (*DB) ReplayRelationalImport added in v1.3.0

func (db *DB) ReplayRelationalImport(ctx context.Context, snapshot SQLiteSnapshot, identity RelationalImportIdentity, step RelationalReplayStep, apply func(context.Context, *sql.Conn) error) (digest string, resultErr error)

ReplayRelationalImport commits an ordered domain transition and its receipt atomically. apply must use conn without committing, changing schema, or touching recovery controls. The coordinator must fence writers and validate the final domain state before activation. Exact retries return their original receipt without repeating earlier mutations.

func (*DB) SnapshotRelational added in v1.3.0

func (db *DB) SnapshotRelational(ctx context.Context, destination string) (SQLiteSnapshotResult, error)

SnapshotRelational exports the current logical schema into a portable SQLite image. The caller must stop cross-store writes and retain the result in the deployment manifest. This method does not change the source schema or approve recovered permissions.

func (*DB) SnapshotRelationalImport added in v1.3.0

func (db *DB) SnapshotRelationalImport(ctx context.Context, destination string, original SQLiteSnapshot, identity RelationalImportIdentity, position RelationalReplayPosition) (SQLiteSnapshotResult, error)

SnapshotRelationalImport captures a closed import at its exact replay position. Writers must remain fenced. The result preserves native import controls for inspection. Failure returns no valid snapshot receipt and never releases the import barrier.

func (*DB) SnapshotSQLite added in v1.3.0

func (db *DB) SnapshotSQLite(ctx context.Context, destination string) (SQLiteSnapshotResult, error)

SnapshotSQLite publishes a consistent SQLite image into a new private directory. The directory contains starport.db and snapshot.json. Existing destinations remain untouched. The deployment coordinator must stop cross-store writes before this operation.

func (*DB) WithFreshSchema added in v1.3.0

func (db *DB) WithFreshSchema(ctx context.Context, initialize func(*sql.Tx) error) error

WithFreshSchema holds application tables against writes while initialize runs. The caller must stop all application processes and schema changes beforehand. Only migration metadata may exist. A failed callback rolls back SQL changes.

type MigrationReconciliation added in v1.3.0

type MigrationReconciliation struct {
	OperationID    string
	Name           string
	Digest         string
	Outcome        string
	Actor          string
	EvidenceSHA256 string
}

MigrationReconciliation records an operator's independently verified DDL outcome. Applied means all effects exist. Reverted means all effects of the attempt are absent. The caller authorizes the administrator and retains the evidence bytes.

type MySQLConfig

type MySQLConfig struct {
	// DSN is a go-sql-driver DSN such as
	// user:password@tcp(host:3306)/starport.
	DSN string `env:"DSN"`
}

MySQLConfig configures the MySQL connect.

type PostgresConfig

type PostgresConfig struct {
	// URL is a postgres:// connection URL, database and credentials
	// included.
	URL string `env:"URL"`
}

PostgresConfig configures the PostgreSQL connect.

type RecoveryStartupState added in v1.3.0

type RecoveryStartupState struct {
	Activated      bool
	ClaimSHA256    string
	DecisionSHA256 string
	ReceiptSHA256  string
}

RecoveryStartupState reports checked native recovery controls. It grants no activation authority. Current replay consistency does not establish the originally approved final position.

func InspectRecoveryStartup added in v1.3.0

func InspectRecoveryStartup(ctx context.Context, config Config, deployment string) (state RecoveryStartupState, resultErr error)

InspectRecoveryStartup reads existing selected SQL state before application effects. It creates no database or schema and does not migrate or repair recovery records. Missing schema permits first boot only when no retained recovery schema exists.

type RelationalImportIdentity added in v1.3.0

type RelationalImportIdentity struct {
	OperationID   string `json:"operation_id"`
	RestrictionID string `json:"restriction_id"`
}

RelationalImportIdentity binds an import to its operation and recovery policy. RestrictionID must identify the complete callback policy, including its selected epoch.

type RelationalRecoveryCensus added in v1.3.0

type RelationalRecoveryCensus struct {
	DomainSHA256   string `json:"domain_sha256"`
	WitnessSHA256  string `json:"witness_sha256"`
	ControlSHA256  string `json:"control_sha256"`
	RevisionSHA256 string `json:"revision_sha256"`
	DomainRows     int64  `json:"domain_rows"`
	WitnessRows    int64  `json:"witness_rows"`
	ControlRows    int64  `json:"control_rows"`
	RevisionRows   int64  `json:"revision_rows"`
	AuditHighWater int64  `json:"audit_high_water"`
}

RelationalRecoveryCensus separates portable domain rows from native recovery controls. Every row contributes to one digest. These diagnostics grant no recovery authority.

type RelationalReplayPosition added in v1.3.0

type RelationalReplayPosition struct {
	Sequence      int64  `json:"sequence"`
	ReceiptSHA256 string `json:"receipt_sha256"`
}

RelationalReplayPosition selects an exact retained replay cursor. The zero value selects imported state before the first replay step.

type RelationalReplayStep added in v1.3.0

type RelationalReplayStep struct {
	Sequence         int64  `json:"sequence"`
	PreviousSHA256   string `json:"previous_sha256"`
	EvidenceSHA256   string `json:"evidence_sha256"`
	TransitionSHA256 string `json:"transition_sha256"`
}

RelationalReplayStep binds an ordered domain transition to independent evidence. The domain owner derives TransitionSHA256 from its complete canonical typed input. A digest binds bytes. It does not establish provenance or complete history.

type RelationalSnapshotView added in v1.3.0

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

RelationalSnapshotView owns a verified private copy of a portable SQL image. Its connection is immutable and read-only. It exposes no transaction or write methods.

func OpenRelationalSnapshot added in v1.3.0

func OpenRelationalSnapshot(ctx context.Context, source string, expected SQLiteSnapshot, scratch string) (_ *RelationalSnapshotView, resultErr error)

OpenRelationalSnapshot verifies bytes and the complete schema before exposing records. Scratch must be an existing private directory. Close removes only the owned copy.

func (*RelationalSnapshotView) Close added in v1.3.0

func (v *RelationalSnapshotView) Close() error

Close releases connections and removes only the directory with the captured identity.

func (*RelationalSnapshotView) QueryContext added in v1.3.0

func (v *RelationalSnapshotView) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

QueryContext reads the immutable copy through SQLite's read-only connection.

func (*RelationalSnapshotView) QueryRowContext added in v1.3.0

func (v *RelationalSnapshotView) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

QueryRowContext reads one row from the immutable copy.

func (*RelationalSnapshotView) RecoveryCensus added in v1.3.0

func (v *RelationalSnapshotView) RecoveryCensus(ctx context.Context) (result RelationalRecoveryCensus, resultErr error)

RecoveryCensus streams the complete compiled row contract from an immutable image. It preserves original native controls as separate facts that need owner validation.

type SQLiteConfig

type SQLiteConfig struct {
	// Path is the database file. An empty path opens an in-memory
	// database that lives and dies with the process.
	Path string `env:"PATH"`
}

SQLiteConfig configures the embedded backend.

type SQLiteSnapshot added in v1.3.0

type SQLiteSnapshot struct {
	Format string `json:"format"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

SQLiteSnapshot identifies a complete database image, including committed WAL data. The deployment manifest must bind this identity to the other persistent stores.

type SQLiteSnapshotResult added in v1.3.0

type SQLiteSnapshotResult struct {
	Snapshot  SQLiteSnapshot
	Published bool
}

SQLiteSnapshotResult reports publication separately from the final directory sync. Published can be true with an error when durability remains uncertain.

func RestoreSQLiteSnapshot added in v1.3.0

func RestoreSQLiteSnapshot(ctx context.Context, destination, source string, expected SQLiteSnapshot) (SQLiteSnapshotResult, error)

RestoreSQLiteSnapshot verifies an image and publishes it into a new private directory. This imports bytes only. It does not approve recovery or select the database for a running gateway. The caller must fence old writers and reconcile independent history before admission.

Jump to

Keyboard shortcuts

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