pub struct LifecycleLedger { /* private fields */ }Expand description
Source of truth from admission through completion publication.
Implementations§
Source§impl LifecycleLedger
impl LifecycleLedger
Sourcepub fn transaction_ids(&self) -> Vec<TransactionId>
pub fn transaction_ids(&self) -> Vec<TransactionId>
Snapshot of all transaction ids (for shutdown).
Sourcepub fn get(&self, id: &TransactionId) -> Option<&LedgerEntry>
pub fn get(&self, id: &TransactionId) -> Option<&LedgerEntry>
Lookup by id.
Sourcepub fn get_mut(&mut self, id: &TransactionId) -> Option<&mut LedgerEntry>
pub fn get_mut(&mut self, id: &TransactionId) -> Option<&mut LedgerEntry>
Mutable lookup by id.
Sourcepub fn session_active(&self, key: &SessionKey) -> bool
pub fn session_active(&self, key: &SessionKey) -> bool
Whether a session key is already active.
Sourcepub fn transaction_for_session(&self, key: &SessionKey) -> Option<TransactionId>
pub fn transaction_for_session(&self, key: &SessionKey) -> Option<TransactionId>
Resolve the active transaction for a session key.
Sourcepub fn distinct_sessions_on_channel(&self, channel: &ChannelId) -> usize
pub fn distinct_sessions_on_channel(&self, channel: &ChannelId) -> usize
Count distinct active sessions on a channel (D-015 / ChannelLimits).
Sourcepub fn insert_queued(
&mut self,
entry: LedgerEntry,
max_distinct_sessions: Option<usize>,
) -> Result<(), LedgerInsertError>
pub fn insert_queued( &mut self, entry: LedgerEntry, max_distinct_sessions: Option<usize>, ) -> Result<(), LedgerInsertError>
Insert a complete Queued entry. Returns Err if id or session collides
or if max_distinct_sessions would be exceeded for a new SessionKey.
Sourcepub fn remove(&mut self, id: &TransactionId) -> Option<LedgerEntry>
pub fn remove(&mut self, id: &TransactionId) -> Option<LedgerEntry>
Remove an entry and drop its reservations (via Drop).
Sourcepub fn bind_session(
&mut self,
id: &TransactionId,
key: SessionKey,
max_distinct_sessions: Option<usize>,
) -> Result<(), LedgerInsertError>
pub fn bind_session( &mut self, id: &TransactionId, key: SessionKey, max_distinct_sessions: Option<usize>, ) -> Result<(), LedgerInsertError>
Bind session key after external session claim (supervisor only).
When max_distinct_sessions is Some, a net-new session on the channel
that would exceed the bound fails with DistinctSessionsExceeded.
Replacing an existing key on the same channel does not consume an extra
distinct slot.
D-063: admission (insert_queued) already reserves SessionKey in
by_session for a resumed transaction (session_id: Some(..) on
TransactionSubmitRequest), bound to that transaction’s own id, before
the claim below ever runs. If the existing holder is id, this call
is that same transaction re-confirming its own admission-time
reservation once the external session is established — not a new
distinct-session slot — so it must succeed as a no-op rather than
reject its own resume with SessionAlreadyActive.