pub struct SessionMetadataStore { /* private fields */ }Expand description
File-backed session metadata with schema migration.
Implementations§
Source§impl SessionMetadataStore
impl SessionMetadataStore
pub fn open(path: impl Into<PathBuf>) -> Self
pub fn path(&self) -> &Path
pub fn read(&self) -> Result<Option<LoadedSessionMetadata>, PersistenceError>
pub fn load(&self) -> Result<Option<LoadedSessionMetadata>, PersistenceError>
Sourcepub fn update<F>(&self, edit: F) -> Result<(), PersistenceError>where
F: FnOnce(&mut SessionMetadata),
pub fn update<F>(&self, edit: F) -> Result<(), PersistenceError>where
F: FnOnce(&mut SessionMetadata),
Read the current snapshot, apply an in-memory edit, and atomically publish the replacement. A missing snapshot is treated as empty metadata; malformed or newer snapshots are left untouched and returned as errors.
pub fn write(&self, metadata: &SessionMetadata) -> Result<(), PersistenceError>
pub fn migrate_in_place(&self) -> Result<MigrationReport, PersistenceError>
Sourcepub fn buffered(&self) -> Result<BufferedSessionMetadataStore>
pub fn buffered(&self) -> Result<BufferedSessionMetadataStore>
Start a background metadata writer. Runtime event loops should enqueue
snapshots through this handle and call BufferedSessionMetadataStore::flush
only at lifecycle boundaries; atomic writes and fsync therefore never
block terminal input or rendering.
pub fn buffered_with_errors( &self, on_error: impl Fn(String) + Send + 'static, ) -> Result<BufferedSessionMetadataStore>
Trait Implementations§
Source§impl Clone for SessionMetadataStore
impl Clone for SessionMetadataStore
Source§fn clone(&self) -> SessionMetadataStore
fn clone(&self) -> SessionMetadataStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionMetadataStore
impl RefUnwindSafe for SessionMetadataStore
impl Send for SessionMetadataStore
impl Sync for SessionMetadataStore
impl Unpin for SessionMetadataStore
impl UnsafeUnpin for SessionMetadataStore
impl UnwindSafe for SessionMetadataStore
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