Documentation
¶
Overview ¶
Package sqlite implements the store contract on one SQLite database, dockhand v3's ~/.dockhand/dockhand.db.
The database is opened in WAL mode with foreign keys on and full sync, through to the disk on macOS, and its planner's statistics kept. A write transaction begins IMMEDIATE, so writers queue on SQLite's lock instead of failing midway, and a commit whose outcome is unknown says so with store.ErrUncertain. The schema carries the rules it can check by itself: valid states, unique run numbers and snapshot numbers, final checkpoints, and lease generations that never decrease.
Index ¶
- func CreateAt(path string, version int, setup string) error
- type Migration
- type Options
- type Store
- func (s *Store) Close() error
- func (s *Store) Migration() *Migration
- func (s *Store) Register(ctx context.Context, commonDir string) (model.RepositoryID, error)
- func (s *Store) Repositories(ctx context.Context) ([]string, error)
- func (s *Store) Update(ctx context.Context, repository model.RepositoryID, fn func(store.Tx) error) error
- func (s *Store) View(ctx context.Context, repository model.RepositoryID, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Migration ¶
type Migration struct {
From, To int
Copy string
// Release is the release that last opened the database, where this
// build isn't one and migrated it as MigrateRelease let it: that
// release can't open it after.
Release string
}
Migration is a schema migration Open made, and where the database's form before it is kept: a build older than the migration can't open the database after it, and can open the copy.
type Options ¶
type Options struct {
BusyTimeout time.Duration
OperationTimeout time.Duration
// MigrateUnderLive migrates the schema though dockhand processes that
// read the older one are working, a person's answer; otherwise such a
// migration is refused (store.LiveUnderMigrationError).
MigrateUnderLive bool
// Build is this build's version, as buildinfo.Info.String gives it, and
// MigrateRelease migrates a database a release last opened with a
// build that isn't one, a person's answer or a copy they named, which
// is otherwise refused (store.ReleaseUnderMigrationError).
Build string
MigrateRelease bool
// LiveWithin is how recent a heartbeat says a process is working,
// coord.DefaultHungAfter, which the engine gives; where it's zero,
// every session not ended is working.
LiveWithin time.Duration
// Heartbeat is how often a working process records its heartbeat,
// coord's, which the engine gives. Where it's set, a migration
// refused for live processes counts only those whose heartbeat moves
// in this file while it waits three beats: a copy of a database
// carries its sessions, fresh, and the processes behind them work on
// the original (field testing's .backup copy, 2026-10-29).
Heartbeat time.Duration
}
Options tunes how the database is opened.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a dockhand v3 database.
func Open ¶
Open opens the database at path, creating it and its directory when absent, and refuses a file that is not a dockhand v3 database.
func (*Store) Repositories ¶ added in v0.5.0
Repositories lists the registered Git common directories, oldest first.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sqlitetest gives tests a new dockhand database without each running every migration: a fresh database takes the schema's whole history, about fifty migrations, each in its own transaction synced to the disk, and hundreds of tests open one.
|
Package sqlitetest gives tests a new dockhand database without each running every migration: a fresh database takes the schema's whole history, about fifty migrations, each in its own transaction synced to the disk, and hundreds of tests open one. |