Documentation
¶
Overview ¶
Package retention holds the owner's retention settings: how long each table the sweep prunes keeps its rows. Every value is a whole number stored as the setting "retention.<name>"; a missing or unusable value means the default, which is what the panel always did. The package is small and has no dependencies because the health sweep reads it on every edition.
Index ¶
Constants ¶
const Prefix = "retention."
Prefix starts every retention setting key.
Variables ¶
var Fields = [...]Field{
{"journal_days", 7, 1, 7, day},
{"events_info_days", 90, 1, 365, day},
{"events_warn_days", 400, 1, 1095, day},
{"audit_days", 400, 30, 1095, day},
{"alerts_days", 90, 7, 730, day},
{"check_samples_hours", 25, 25, 168, hour},
{"check_daily_days", 90, 7, 730, day},
{"host_history_days", 90, 7, 365, day},
{"traffic_bucket_days", 400, 30, 3650, day},
{"node_traffic_hour_days", 400, 30, 3650, day},
{"networks_days", 7, 1, 7, day},
}
Fields lists the settings in display order.
Functions ¶
Types ¶
type Field ¶
type Field struct {
Key string // the part after Prefix, also the MCP and RPC name
Default int
Min, Max int
Unit time.Duration // what one unit of the value is: an hour or a day
}
Field is one retention setting.
type Policy ¶
Policy is the effective retention: Values[i] belongs to Fields[i].
func Default ¶
func Default() Policy
Default is the policy of a panel whose owner never changed anything.
func Parse ¶
Parse reads stored settings (as SettingValues returns them). A value that is not a number, or is out of its limits, is the default: a hand-edited row cannot make the sweep delete everything.