diff options
| author | Fuwn <[email protected]> | 2026-01-23 17:28:43 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-23 17:28:43 -0800 |
| commit | dd26b219eb322deb511fcdecfdbecb6c963d20d2 (patch) | |
| tree | 40e02860835c96cd4a3711fc48616ad08954586e /internal/config | |
| parent | feat: Add config imports for monitor inheritance (diff) | |
| download | kaze-dd26b219eb322deb511fcdecfdbecb6c963d20d2.tar.xz kaze-dd26b219eb322deb511fcdecfdbecb6c963d20d2.zip | |
feat: Add database maintenance with backup/reset modes and triggers
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index f97add5..250827b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -73,8 +73,24 @@ type ServerConfig struct { // StorageConfig contains database settings type StorageConfig struct { - Path string `yaml:"path"` - HistoryDays int `yaml:"history_days"` + Path string `yaml:"path"` + HistoryDays int `yaml:"history_days"` + Maintenance MaintenanceConfig `yaml:"maintenance,omitempty"` +} + +// MaintenanceConfig controls database maintenance/pruning behavior +type MaintenanceConfig struct { + // Mode: "never" (default), "backup" (rename with epoch suffix), "reset" (delete in place) + Mode string `yaml:"mode,omitempty"` + Triggers MaintenanceTriggers `yaml:"triggers,omitempty"` +} + +// MaintenanceTriggers defines when maintenance should occur (OR'd together) +type MaintenanceTriggers struct { + Size string `yaml:"size,omitempty"` // e.g., "100MB", "1GB" + Checks int64 `yaml:"checks,omitempty"` // total check count threshold + Cron string `yaml:"cron,omitempty"` // cron expression, e.g., "0 3 * * 0" + Daily string `yaml:"daily,omitempty"` // daily time, e.g., "03:00" } // GroupConfig represents a group of monitors |