Struct FileStore
pub struct FileStore {
writer: Writer,
compact_threshold: Option<u64>,
bytes_since_compact: u64,
frame_buf: Vec<u8>,
}Expand description
The runtime journal-file backend: an append-only writer plus compaction bookkeeping.
Fields§
§writer: Writer§compact_threshold: Option<u64>§bytes_since_compact: u64Journal bytes written since the last compaction. Persists across reconnects with the store so short-lived connections do not reset it.
frame_buf: Vec<u8>The single reused buffer the pending ops are framed into and then moved to the writer’s blocking pool, so a steady stream of flushes performs no per-flush allocation and no intermediate copy.
Implementations§
§impl FileStore
impl FileStore
pub(crate) async fn persist(
&mut self,
client: &mut Client<JournaledSession>,
) -> Result<()>
pub(crate) async fn persist( &mut self, client: &mut Client<JournaledSession>, ) -> Result<()>
Frames the session’s pending ops, appends them, and once the growth threshold is exceeded compacts the journal. Clears the in-memory buffer only on a successful append, so a failed write keeps the ops buffered and the returned error lets the caller stop acknowledging state that was never made durable.
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnwindSafe for FileStore
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