Documentation
¶
Overview ¶
Package storeops runs the periodic operations that treat the bbolt file as an operational artifact rather than a set of rows: timestamped snapshots with retention pruning, and the file-size and freelist gauges.
Both were background goroutine bodies on Server. They read four things — the store, the metrics recorder, the live config, and the disk-full classifier — which is the same Deps-plus-a-live-config shape the scheduler package already takes, so they belong beside it rather than on the composition root. The two share a package because they share a subject: one writes the file, the other measures it, and both are the only code that cares how large it is.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
DB store
Metrics metrics
// Cfg resolves the LIVE config each cycle, so enable, frequency, retention
// and path changes take effect on the next iteration without a restart. It
// returns nil in unconfigured mode, which the backup loop treats as disabled.
Cfg func() *config.Config
// RecordStoreWriteError classifies a write failure as a possible disk-full
// condition. Injected rather than imported: the classifier needs the concrete
// engine's error taxonomy, and this package names no engine.
RecordStoreWriteError func(error)
}
Deps is what the runners need.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner owns the periodic store-file operations.
func (*Runner) RunBackup ¶
RunBackup periodically writes a database snapshot and prunes old backups until ctx is cancelled.
func (*Runner) RunMetrics ¶
RunMetrics periodically reads the bbolt file size and freelist stats and records them as Prometheus gauges. It exits when ctx is cancelled.