pub struct InputLedger { /* private fields */ }Expand description
In-memory ledger tracking InputState for all inputs.
Implementations§
Source§impl InputLedger
impl InputLedger
Sourcepub fn accept(&mut self, state: InputState)
pub fn accept(&mut self, state: InputState)
Accept a new InputState into the ledger.
Sourcepub fn accept_with_idempotency(
&mut self,
state: InputState,
key: IdempotencyKey,
) -> Option<InputId>
pub fn accept_with_idempotency( &mut self, state: InputState, key: IdempotencyKey, ) -> Option<InputId>
Accept with an idempotency key for dedup.
Returns Some(existing_id) if the key already exists (dedup hit).
Sourcepub fn recover(&mut self, state: InputState) -> bool
pub fn recover(&mut self, state: InputState) -> bool
Recover a durable InputState from persistent storage.
Unlike accept(), this also rebuilds the idempotency index
and filters out Ephemeral inputs (which should not survive restart).
Returns true if the state was inserted, false if filtered.
Sourcepub fn get(&self, input_id: &InputId) -> Option<&InputState>
pub fn get(&self, input_id: &InputId) -> Option<&InputState>
Get the state of a specific input.
Sourcepub fn remove(&mut self, input_id: &InputId) -> Option<InputState>
pub fn remove(&mut self, input_id: &InputId) -> Option<InputState>
Remove an input from the ledger and dedup index.
Sourcepub fn get_mut(&mut self, input_id: &InputId) -> Option<&mut InputState>
pub fn get_mut(&mut self, input_id: &InputId) -> Option<&mut InputState>
Get mutable reference to the state of a specific input.
Sourcepub fn iter_non_terminal(&self) -> impl Iterator<Item = (&InputId, &InputState)>
pub fn iter_non_terminal(&self) -> impl Iterator<Item = (&InputId, &InputState)>
Iterate over all non-terminal input states.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&InputId, &InputState)>
pub fn iter(&self) -> impl Iterator<Item = (&InputId, &InputState)>
Iterate over all input states.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Number of non-terminal entries.
Sourcepub fn active_input_ids(&self) -> Vec<InputId>
pub fn active_input_ids(&self) -> Vec<InputId>
Get all active (non-terminal) input IDs.
Trait Implementations§
Source§impl Clone for InputLedger
impl Clone for InputLedger
Source§fn clone(&self) -> InputLedger
fn clone(&self) -> InputLedger
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputLedger
impl Debug for InputLedger
Source§impl Default for InputLedger
impl Default for InputLedger
Source§fn default() -> InputLedger
fn default() -> InputLedger
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InputLedger
impl RefUnwindSafe for InputLedger
impl Send for InputLedger
impl Sync for InputLedger
impl Unpin for InputLedger
impl UnsafeUnpin for InputLedger
impl UnwindSafe for InputLedger
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