Struct FilePersistence
pub struct FilePersistence {
path: PathBuf,
compact_threshold_bytes: Option<u64>,
}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>Implementations§
§impl FilePersistence
impl FilePersistence
pub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> 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(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 From<FilePersistence> for SessionPersistence
impl From<FilePersistence> for SessionPersistence
§fn from(config: FilePersistence) -> Self
fn from(config: FilePersistence) -> Self
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 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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