pub struct ForkBasedPersistence { /* private fields */ }Expand description
Fork-based background save
Implementations§
Source§impl ForkBasedPersistence
impl ForkBasedPersistence
pub fn new<P: AsRef<Path>>(data_dir: P) -> Self
Sourcepub fn bgsave(
&self,
collections: &HashMap<String, Arc<Collection>>,
) -> Result<bool>
pub fn bgsave( &self, collections: &HashMap<String, Arc<Collection>>, ) -> Result<bool>
Start background save (bgsave) - forks a child process
Sourcepub fn load_snapshot(&self) -> Result<Option<SnapshotData>>
pub fn load_snapshot(&self) -> Result<Option<SnapshotData>>
Load snapshot from disk (on startup) Handles corruption gracefully:
- Validates data integrity
- Backs up corrupt files
- Returns None instead of crashing
- Logs detailed warnings
Sourcepub fn is_bgsave_in_progress() -> bool
pub fn is_bgsave_in_progress() -> bool
Check if background save is in progress
Sourcepub fn last_save_time() -> u64
pub fn last_save_time() -> u64
Get last save time
Auto Trait Implementations§
impl Freeze for ForkBasedPersistence
impl RefUnwindSafe for ForkBasedPersistence
impl Send for ForkBasedPersistence
impl Sync for ForkBasedPersistence
impl Unpin for ForkBasedPersistence
impl UnwindSafe for ForkBasedPersistence
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