Documentation
¶
Overview ¶
Package backend opens the state store the configuration names, so the server and the CLIs do not each switch on the driver.
Index ¶
Constants ¶
const ( DriverSQLite = "sqlite" DriverPostgres = "postgres" )
The drivers.
Variables ¶
This section is empty.
Functions ¶
func Backup ¶
Backup writes a backup of the store o names to out, which must not exist. It never opens the store, so it works whatever the schema version.
Types ¶
type Checkpointer ¶
type Checkpointer interface {
StartCheckpointer(ctx context.Context, interval time.Duration, logger *slog.Logger) <-chan struct{}
}
Checkpointer is implemented by a backend with a write-ahead log to fold back (SQLite).
type Options ¶
type Options struct {
Driver string // DriverSQLite (also when empty) or DriverPostgres
SQLitePath string
PostgresDSN string
MaxConns int // PostgreSQL write pool size
// AutoMigrate applies pending migrations before Open returns. The zero
// Options never migrates, unlike sqlite.DefaultOptions and
// postgres.DefaultOptions. The server sets it; the backup and worker CLIs
// leave it false because they write into an existing schema and must
// never create one; migrate drives goose itself.
AutoMigrate bool
ServerLock bool // take the single-server lock (both drivers)
// HA says the server runs in a high-availability group: on PostgreSQL its
// lock is shared with the group's other servers and its sessions are
// bounded by LeaseTTL (see postgres.Options). Ignored by SQLite, which
// cannot run a group.
HA bool
LeaseTTL time.Duration
Logger *slog.Logger
}
Options says which store to open and how.