Documentation
¶
Overview ¶
Package backup produces and manages the pre-migrated database dump shared by every worktree of a project.
Index ¶
- Constants
- func DumpPath(root, name string) string
- func ProjectDir(root, name string) (string, error)
- type Info
- type Manager
- func (m *Manager) Check(ctx context.Context, name string, p config.Project) Staleness
- func (m *Manager) DumpPath(name string) string
- func (m *Manager) List(cfg *config.Config) ([]Info, error)
- func (m *Manager) MetaPath(name string) string
- func (m *Manager) ReadMeta(name string) (Meta, error)
- func (m *Manager) Refresh(ctx context.Context, name string, p config.Project) error
- func (m *Manager) Remove(name string) (bool, error)
- type Meta
- type Staleness
Constants ¶
const ( // RestoreScriptName is the docker-entrypoint-initdb.d script each worktree // reaches through its .db-snapshot link. RestoreScriptName = "restore-snapshot.sh" )
Variables ¶
This section is empty.
Functions ¶
func ProjectDir ¶ added in v0.10.0
ProjectDir is where a project's dump, its meta and the restore script live. It is 0755 under a 0700 root on purpose: the database container mounts this very directory and runs the restore as its own user, never as root.
Types ¶
type Manager ¶
type Staleness ¶
type Staleness struct {
Commits int // commits touching migrations since the dump was taken
Known bool // false when the recorded revision cannot be compared
}
Staleness says how far a dump has fallen behind the migrations it was built from. A stale dump still works, the application simply replays the delta on startup, so this is worth reporting and never worth blocking on.