pub struct CorrelationSnapshot {
pub version: u32,
pub windows: HashMap<String, Vec<(GroupKey, WindowState)>>,
pub last_alert: HashMap<String, Vec<(GroupKey, i64)>>,
pub event_buffers: HashMap<String, Vec<(GroupKey, EventBuffer)>>,
pub event_ref_buffers: HashMap<String, Vec<(GroupKey, EventRefBuffer)>>,
pub tenants: Vec<TenantStateSnapshot>,
pub rulesets: BTreeMap<String, CorrelationSnapshot>,
}Expand description
Serializable snapshot of all mutable correlation state.
Uses stable string identifiers (correlation id/name/title) as keys so the
snapshot can be restored after a rule reload, even if internal indices change.
Inner maps use Vec<(GroupKey, T)> instead of HashMap<GroupKey, T> because
GroupKey cannot be used as a JSON object key.
Version 2 nests state under Self::tenants; the top-level maps hold the
version 1 layout and are read as tenant None but never written.
Fields§
§version: u32Schema version — used to detect incompatible snapshots on load.
windows: HashMap<String, Vec<(GroupKey, WindowState)>>Version 1 layout: per-correlation, per-group window state, read as
tenant None.
last_alert: HashMap<String, Vec<(GroupKey, i64)>>Version 1 layout: per-correlation, per-group last alert timestamp.
event_buffers: HashMap<String, Vec<(GroupKey, EventBuffer)>>Version 1 layout: per-correlation, per-group compressed event buffers.
event_ref_buffers: HashMap<String, Vec<(GroupKey, EventRefBuffer)>>Version 1 layout: per-correlation, per-group event reference buffers.
tenants: Vec<TenantStateSnapshot>Version 2 layout: one entry per tenant.
rulesets: BTreeMap<String, CorrelationSnapshot>Per-ruleset snapshots, keyed by ruleset name. Empty for a single collection.
Implementations§
Source§impl CorrelationSnapshot
impl CorrelationSnapshot
Sourcepub fn has_collection_state(&self) -> bool
pub fn has_collection_state(&self) -> bool
Whether the snapshot carries state outside the per-ruleset map.
Sourcepub fn window_entries(&self) -> usize
pub fn window_entries(&self) -> usize
Window entries in the snapshot and every per-ruleset snapshot.