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 input_id_for_idempotency_key(
&self,
key: &IdempotencyKey,
) -> Option<InputId>
pub fn input_id_for_idempotency_key( &self, key: &IdempotencyKey, ) -> Option<InputId>
Look up the canonical input ID for an idempotency key.
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. “Active” (non-terminal) filtering must happen at the driver level, which has DSL access; the ledger by itself carries only shell metadata.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more