pub struct Persistent<T>{ /* private fields */ }Expand description
A persistent CRDT wrapper with journaling (native platform).
Wraps any type implementing Merge + Serialize + DeserializeOwned
and provides durable storage with crash recovery.
This is the native version with Send bounds required for thread-safe access.
The WASM version relaxes these bounds since JavaScript is single-threaded.
Implementations§
Source§impl<T> Persistent<T>
Native implementation with Send bounds.
impl<T> Persistent<T>
Native implementation with Send bounds.
Sourcepub async fn mount(
vfs: Arc<dyn Vfs + Send + Sync>,
path: &str,
) -> VfsResult<Self>
pub async fn mount( vfs: Arc<dyn Vfs + Send + Sync>, path: &str, ) -> VfsResult<Self>
Mount a persistent value from a journal file.
If the journal exists, replays all entries to reconstruct state. If not, creates a new journal with default state.
Sourcepub async fn entry_count(&self) -> u64
pub async fn entry_count(&self) -> u64
Get the number of journal entries.
Sourcepub async fn maybe_compact(&self, threshold: u64) -> VfsResult<bool>
pub async fn maybe_compact(&self, threshold: u64) -> VfsResult<bool>
Automatically compact when entry count exceeds threshold.
Auto Trait Implementations§
impl<T> Freeze for Persistent<T>
impl<T> !RefUnwindSafe for Persistent<T>
impl<T> Send for Persistent<T>
impl<T> Sync for Persistent<T>where
T: Sync,
impl<T> Unpin for Persistent<T>where
T: Unpin,
impl<T> UnsafeUnpin for Persistent<T>
impl<T> !UnwindSafe for Persistent<T>
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