pub struct MemoryLedger { /* private fields */ }Expand description
In-memory SessionLedger for tests and for callers that hold the live
SessionRef map next to the bridge.
Implementations§
Source§impl MemoryLedger
impl MemoryLedger
pub fn new() -> Self
Sourcepub fn track_task(&self, task_id: &str, attempt: i64)
pub fn track_task(&self, task_id: &str, attempt: i64)
Register a task the bridge may seed a row for, with its attempt count.
Sourcepub fn track_session(&self, session: SessionRef)
pub fn track_session(&self, session: SessionRef)
Insert a live session ref the bridge prefers over the stored reference.
pub fn events(&self) -> Vec<(String, Value)>
pub fn alerts(&self) -> Vec<String>
Trait Implementations§
Source§impl Debug for MemoryLedger
impl Debug for MemoryLedger
Source§impl Default for MemoryLedger
impl Default for MemoryLedger
Source§impl SessionLedger for MemoryLedger
impl SessionLedger for MemoryLedger
Source§fn get_session(&self, task_id: &str) -> Result<Option<SessionRecord>>
fn get_session(&self, task_id: &str) -> Result<Option<SessionRecord>>
Load the session row serving one delivery.
Source§fn upsert_session(
&self,
task_id: &str,
version: &VersionedSession,
) -> Result<bool>
fn upsert_session( &self, task_id: &str, version: &VersionedSession, ) -> Result<bool>
Monotonic session upsert, which also opens the delivery’s binding.
Returns true when the row changed.
Source§fn task_is_known(&self, task_id: &str) -> Result<bool>
fn task_is_known(&self, task_id: &str) -> Result<bool>
Whether the task itself is tracked, so a stray report cannot conjure a row.
Source§fn task_attempt(&self, task_id: &str) -> Result<i64>
fn task_attempt(&self, task_id: &str) -> Result<i64>
Attempt count for a task, for the fault audit entry.
Source§fn list_faults(&self, task_id: &str) -> Result<Vec<FaultRecord>>
fn list_faults(&self, task_id: &str) -> Result<Vec<FaultRecord>>
Existing faults for one task, for the
(task_id, kind, generation) dedupe.Source§fn insert_fault(&self, fault: &FaultRecord) -> Result<i64>
fn insert_fault(&self, fault: &FaultRecord) -> Result<i64>
Append one fault row. Returns its id.
Source§fn emit(&self, kind: &str, data: Value)
fn emit(&self, kind: &str, data: Value)
Observe an emitted event. The bridge never reads back from this hook.
Source§fn note_alert(&self, line: String)
fn note_alert(&self, line: String)
Observe an operator-visible alert line.
Auto Trait Implementations§
impl !Freeze for MemoryLedger
impl RefUnwindSafe for MemoryLedger
impl Send for MemoryLedger
impl Sync for MemoryLedger
impl Unpin for MemoryLedger
impl UnsafeUnpin for MemoryLedger
impl UnwindSafe for MemoryLedger
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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