pub struct FileLeaseStore { /* private fields */ }Expand description
One lease record per file, replaced atomically: the record is written to
<path>.tmp, fsynced, renamed over <path>, and the directory is fsynced
(Unix). load reads only <path>, so a torn temp file left by a crash is
ignored and overwritten by the next save. The file carries a checksum; a
committed file that fails it is reported as StoreError::Corrupt.
One process should own a given file; the store does not lock across processes.
Implementations§
Trait Implementations§
Source§impl Clone for FileLeaseStore
impl Clone for FileLeaseStore
Source§impl Debug for FileLeaseStore
impl Debug for FileLeaseStore
Source§impl LeaseStore for FileLeaseStore
impl LeaseStore for FileLeaseStore
Source§fn load(&self) -> Result<Option<LeaseRecord>, StoreError>
fn load(&self) -> Result<Option<LeaseRecord>, StoreError>
Ok(None) when nothing was ever saved.fn save(&self, record: &LeaseRecord) -> Result<(), StoreError>
Auto Trait Implementations§
impl Freeze for FileLeaseStore
impl RefUnwindSafe for FileLeaseStore
impl Send for FileLeaseStore
impl Sync for FileLeaseStore
impl Unpin for FileLeaseStore
impl UnsafeUnpin for FileLeaseStore
impl UnwindSafe for FileLeaseStore
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