pub struct DecisionLedger<C, A> { /* private fields */ }Expand description
Bounded pending decisions plus bounded completed tombstones.
Implementations§
Source§impl<C, A> DecisionLedger<C, A>
impl<C, A> DecisionLedger<C, A>
Sourcepub fn new(config: DecisionLedgerConfig) -> Result<Self, DecisionLedgerError>
pub fn new(config: DecisionLedgerConfig) -> Result<Self, DecisionLedgerError>
Create an empty ledger with explicit capacity bounds.
Sourcepub fn register(
&mut self,
decision: PendingDecision<C, A>,
) -> Result<DecisionReceipt, DecisionLedgerError>
pub fn register( &mut self, decision: PendingDecision<C, A>, ) -> Result<DecisionReceipt, DecisionLedgerError>
Register immutable decision facts, accepting exact idempotent replay.
Sourcepub fn apply_feedback(
&mut self,
outcome: DecisionOutcome<A>,
) -> Result<FeedbackStatus, DecisionLedgerError>
pub fn apply_feedback( &mut self, outcome: DecisionOutcome<A>, ) -> Result<FeedbackStatus, DecisionLedgerError>
Validate and apply delayed feedback transactionally.
Sourcepub fn pending(&self, id: DecisionId) -> Option<&PendingDecision<C, A>>
pub fn pending(&self, id: DecisionId) -> Option<&PendingDecision<C, A>>
Return pending decision facts without updating state.
Sourcepub fn completed(&self, id: DecisionId) -> Option<&CompletedDecision<C, A>>
pub fn completed(&self, id: DecisionId) -> Option<&CompletedDecision<C, A>>
Return a completed tombstone without updating state.
Sourcepub fn pending_len(&self) -> usize
pub fn pending_len(&self) -> usize
Number of incomplete decisions.
Sourcepub fn completed_len(&self) -> usize
pub fn completed_len(&self) -> usize
Number of retained completed tombstones.
Sourcepub fn validate(&self) -> Result<(), RillError>
pub fn validate(&self) -> Result<(), RillError>
Validate all feature-independent structural and bounded-value invariants.
This is available even when the optional serde feature is disabled;
[ValidateState] delegates to the same checks when serde persistence is
enabled.
Sourcepub fn clear_expired(&mut self, now: u64) -> Vec<DecisionId>
pub fn clear_expired(&mut self, now: u64) -> Vec<DecisionId>
Explicitly clear decisions whose expiry is strictly before now.
Sourcepub fn clear_completed_before(&mut self, before: u64) -> Vec<DecisionId>
pub fn clear_completed_before(&mut self, before: u64) -> Vec<DecisionId>
Explicitly clear tombstones observed strictly before before.
Trait Implementations§
Source§impl<C: Clone, A: Clone> Clone for DecisionLedger<C, A>
impl<C: Clone, A: Clone> Clone for DecisionLedger<C, A>
Source§fn clone(&self) -> DecisionLedger<C, A>
fn clone(&self) -> DecisionLedger<C, A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more