Skip to main content

BufferedSessionArchive

Struct BufferedSessionArchive 

Source
pub struct BufferedSessionArchive { /* private fields */ }
Expand description

Background archive writer used from the terminal event loop.

The handle only serializes events and queues commands; all filesystem work happens on its worker thread. Queued journal lines and metadata edits are retried until flush or drop makes them durable, and the entry’s updated_at advances at each successful boundary that received events so the session browser can order by last activity.

Implementations§

Source§

impl BufferedSessionArchive

Source

pub fn id(&self) -> &str

Source

pub fn append(&self, event: &ArchiveEvent) -> Result<(), PersistenceError>

Serialize and queue one journal record without filesystem I/O in the caller.

Source

pub fn append_human( &self, text: impl Into<String>, direct: bool, ) -> Result<(), PersistenceError>

Source

pub fn append_agent(&self, event: &AgentEvent) -> Result<(), PersistenceError>

Source

pub fn replace_metadata( &self, metadata: SessionMetadata, ) -> Result<(), PersistenceError>

Queue a complete provider metadata snapshot, retaining unknown keys.

Source

pub fn update_metadata<F>(&self, apply: F) -> Result<(), PersistenceError>
where F: FnOnce(&mut SessionMetadata) + Send + 'static,

Queue an in-place provider metadata edit, preserving unknown keys.

Source

pub fn update_entry<F>(&self, apply: F) -> Result<(), PersistenceError>
where F: FnOnce(&mut ArchiveEntry) + Send + 'static,

Queue an archive entry edit (title, state, roster). The session id is pinned to the directory and titles stay bounded.

Source

pub fn touch(&self) -> Result<(), PersistenceError>

Queue an activity timestamp update.

Source

pub fn checkpoint(&self) -> Result<(), PersistenceError>

Request a durable checkpoint without blocking the UI.

Source

pub fn flush(&self) -> Result<(), PersistenceError>

Drain queued records and metadata edits and make them durable.

Trait Implementations§

Source§

impl Debug for BufferedSessionArchive

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for BufferedSessionArchive

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.