Struct FilePersistence
pub struct FilePersistence {
path: PathBuf,
compact_threshold_bytes: Option<u64>,
pending_limit_bytes: usize,
}tokio only.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§
§impl FilePersistence
impl FilePersistence
pub fn new<P: Into<PathBuf>>(path: P) -> Self
pub fn new<P: Into<PathBuf>>(path: P) -> Self
Persists the session to a journal file at path, without automatic
compaction.
pub const fn compact_threshold_bytes(self, bytes: u64) -> Self
pub const fn compact_threshold_bytes(self, bytes: u64) -> Self
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.
pub const fn pending_limit_bytes(self, bytes: usize) -> Self
pub const fn pending_limit_bytes(self, bytes: usize) -> Self
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.
pub(crate) async fn build(self) -> Result<(JournaledSession, FileStore)>
pub(crate) async fn build(self) -> Result<(JournaledSession, FileStore)>
Replays the journal and opens it for appending.
Trait Implementations§
§impl Debug for FilePersistence
impl Debug for FilePersistence
§impl From<FilePersistence> for SessionPersistence
impl From<FilePersistence> for SessionPersistence
§fn from(config: FilePersistence) -> Self
fn from(config: FilePersistence) -> Self
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
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> ⓘ
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> ⓘ
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