Struct FilePersistence
pub struct FilePersistence {
path: PathBuf,
compact_threshold_bytes: Option<u64>,
pending_limit_bytes: usize,
}Expand description
Configures session persistence backed by a CRC-framed journal file.
Build one with new and pass it to
ClientBuilder::persistence.
Fields§
§path: PathBuf§compact_threshold_bytes: Option<u64>§pending_limit_bytes: usizeImplementations§
Source§impl FilePersistence
impl FilePersistence
Sourcepub fn new<P>(path: P) -> FilePersistence
pub fn new<P>(path: P) -> FilePersistence
Persists the session to a journal file at path, without automatic
compaction.
Sourcepub const fn compact_threshold_bytes(self, bytes: u64) -> FilePersistence
pub const fn compact_threshold_bytes(self, bytes: u64) -> FilePersistence
Sets the journal compaction threshold.
Once the journal has grown by more than bytes since the last
compaction, the event loop compacts it after the next successful flush.
A value around 1 MiB (1 048 576) suits most workloads. Without it the
journal is never compacted automatically.
Sourcepub const fn pending_limit_bytes(self, bytes: usize) -> FilePersistence
pub const fn pending_limit_bytes(self, bytes: usize) -> FilePersistence
Limits the memory used for session changes that are not yet persisted.
Once the changes would take more than bytes, the next persist writes
the whole session instead. This bounds memory while the storage keeps
failing. By default there is no limit.
Trait Implementations§
Source§impl Debug for FilePersistence
impl Debug for FilePersistence
Source§impl From<FilePersistence> for SessionPersistence
impl From<FilePersistence> for SessionPersistence
Source§fn from(config: FilePersistence) -> SessionPersistence
fn from(config: FilePersistence) -> SessionPersistence
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FilePersistence
impl RefUnwindSafe for FilePersistence
impl Send for FilePersistence
impl Sync for FilePersistence
impl Unpin for FilePersistence
impl UnsafeUnpin for FilePersistence
impl UnwindSafe for FilePersistence
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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