pub struct EventLog { /* private fields */ }Expand description
An append-only event log backed by a JSONL file.
Implementations§
Source§impl EventLog
impl EventLog
Sourcepub fn open(session_dir: &Path) -> Result<Self, EventLogError>
pub fn open(session_dir: &Path) -> Result<Self, EventLogError>
Open or create an event log for the given session directory.
The session directory is typically .treeship/sessions/<session_id>/.
If the directory does not exist, it will be created.
Sourcepub fn append(&self, event: &mut SessionEvent) -> Result<(), EventLogError>
pub fn append(&self, event: &mut SessionEvent) -> Result<(), EventLogError>
Append a single event to the log.
The event’s sequence_no is set automatically based on the log position.
Sourcepub fn read_all(&self) -> Result<Vec<SessionEvent>, EventLogError>
pub fn read_all(&self) -> Result<Vec<SessionEvent>, EventLogError>
Read all events from the log.
Sourcepub fn event_count(&self) -> u64
pub fn event_count(&self) -> u64
Return the current event count.
Auto Trait Implementations§
impl !Freeze for EventLog
impl RefUnwindSafe for EventLog
impl Send for EventLog
impl Sync for EventLog
impl Unpin for EventLog
impl UnsafeUnpin for EventLog
impl UnwindSafe for EventLog
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