pub struct RuleDistribution { /* private fields */ }Expand description
In-memory cluster rule store with merge + escalation.
Implementations§
Source§impl RuleDistribution
impl RuleDistribution
Sourcepub fn upsert_local(&mut self, rule: GovernanceRule, now_unix: u64)
pub fn upsert_local(&mut self, rule: GovernanceRule, now_unix: u64)
Insert or replace a locally authored rule (starts at v1 or bumps).
Sourcepub fn active_rules(&self) -> Vec<GovernanceRule>
pub fn active_rules(&self) -> Vec<GovernanceRule>
Snapshot of active rules (for engine injection).
Sourcepub fn set_version(&self) -> u64
pub fn set_version(&self) -> u64
Aggregate set version (sum of per-rule versions).
Sourcepub fn gossip_full(&self) -> RuleGossipEnvelope
pub fn gossip_full(&self) -> RuleGossipEnvelope
Build a gossip envelope of the full local set.
Sourcepub fn merge(&mut self, envelope: &RuleGossipEnvelope) -> usize
pub fn merge(&mut self, envelope: &RuleGossipEnvelope) -> usize
Merge a remote gossip envelope (LWW on version, then timestamp, then origin).
Returns the number of rules accepted (inserted or upgraded).
Sourcepub fn escalate(
&mut self,
agent_id: &str,
action: &str,
local_decision: &GovernanceDecision,
now_unix: u64,
) -> EscalationOutcome
pub fn escalate( &mut self, agent_id: &str, action: &str, local_decision: &GovernanceDecision, now_unix: u64, ) -> EscalationOutcome
After a local Deny, decide whether to escalate to a peer that holds
a newer version of a rule matching action.
Sourcepub fn escalation_log(&self) -> &[EscalationRecord]
pub fn escalation_log(&self) -> &[EscalationRecord]
Escalation audit trail.
Trait Implementations§
Source§impl Debug for RuleDistribution
impl Debug for RuleDistribution
Auto Trait Implementations§
impl Freeze for RuleDistribution
impl RefUnwindSafe for RuleDistribution
impl Send for RuleDistribution
impl Sync for RuleDistribution
impl Unpin for RuleDistribution
impl UnsafeUnpin for RuleDistribution
impl UnwindSafe for RuleDistribution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more