pub struct HandoffLedger { /* private fields */ }Expand description
Append-only JSONL ledger for handoff contexts. Provides durable, append-only storage for handoff history.
Implementations§
Source§impl HandoffLedger
impl HandoffLedger
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Create a new HandoffLedger with the specified file path.
Sourcepub fn append(&self, context: &HandoffContext) -> Result<(), Error>
pub fn append(&self, context: &HandoffContext) -> Result<(), Error>
Append a handoff context to the ledger. Opens the file with O_APPEND + create flags, writes JSON line + newline, and fsyncs.
Sourcepub fn read_all(&self) -> Result<Vec<HandoffContext>, Error>
pub fn read_all(&self) -> Result<Vec<HandoffContext>, Error>
Read all entries from the ledger file.
Returns Vec<HandoffContext> in order of insertion.
Sourcepub fn count(&self) -> Result<usize, Error>
pub fn count(&self) -> Result<usize, Error>
Count entries in the ledger without loading all into memory. Efficiently counts lines in the file.
Sourcepub fn size_bytes(&self) -> Result<u64, Error>
pub fn size_bytes(&self) -> Result<u64, Error>
Return the file size in bytes for monitoring.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HandoffLedger
impl RefUnwindSafe for HandoffLedger
impl Send for HandoffLedger
impl Sync for HandoffLedger
impl Unpin for HandoffLedger
impl UnsafeUnpin for HandoffLedger
impl UnwindSafe for HandoffLedger
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more