Documentation
¶
Index ¶
- type Apply
- type DB
- func (s *DB) Close() error
- func (s *DB) FinishApply(id int64, exitCode int, now time.Time) error
- func (s *DB) GetVersion(id int64) (*SpecVersion, error)
- func (s *DB) HasUnfinishedApply() (bool, error)
- func (s *DB) InsertApply(versionID int64, agent string, now time.Time) (int64, error)
- func (s *DB) InsertVersion(hash string, content []byte, message string, now time.Time) (int64, error)
- func (s *DB) IsApplied(versionID int64) (bool, error)
- func (s *DB) LatestVersion() (*SpecVersion, error)
- func (s *DB) ListApplies() ([]Apply, error)
- func (s *DB) ListVersions() ([]SpecVersion, error)
- func (s *DB) SchemaVersion() (int, error)
- func (s *DB) SetApplyLogPath(id int64, logPath string) error
- type SpecVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Apply ¶
type Apply struct {
ID int64
VersionID int64
Agent string
StartedAt time.Time
FinishedAt *time.Time
ExitCode *int
LogPath string
}
Apply is one agent run against a committed version. FinishedAt and ExitCode are nil until the run completes; nil forever means interrupted.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the SQLite handle and owns migrations.
func (*DB) FinishApply ¶
FinishApply stamps the outcome of an apply run.
func (*DB) GetVersion ¶
func (s *DB) GetVersion(id int64) (*SpecVersion, error)
GetVersion loads one stored snapshot by id.
func (*DB) HasUnfinishedApply ¶
HasUnfinishedApply reports whether any apply row lacks an outcome.
func (*DB) InsertApply ¶
InsertApply records the start of an apply run; log_path starts empty and is filled by SetApplyLogPath once the row id has named the file.
func (*DB) InsertVersion ¶
func (s *DB) InsertVersion(hash string, content []byte, message string, now time.Time) (int64, error)
InsertVersion stores a full spec snapshot and returns its id (displayed as vN).
func (*DB) LatestVersion ¶
func (s *DB) LatestVersion() (*SpecVersion, error)
LatestVersion returns the newest committed version, or nil when none exist.
func (*DB) ListApplies ¶
ListApplies returns all apply rows, newest first.
func (*DB) ListVersions ¶
func (s *DB) ListVersions() ([]SpecVersion, error)
ListVersions returns all versions, newest first.
func (*DB) SchemaVersion ¶
SchemaVersion returns the current schema version.