pub struct Writer<W: Write> { /* private fields */ }Implementations§
Source§impl<W: Write> Writer<W>
impl<W: Write> Writer<W>
Sourcepub fn append<T: Encode>(&mut self, record: T) -> Result<(), T>
pub fn append<T: Encode>(&mut self, record: T) -> Result<(), T>
Append the record (aka transaction) T to the segment.
If the number of currently buffered records would exceed max_records_in_commit
after the method returns, the argument is returned in an Err and not
appended to this writer’s buffer.
Otherwise, the record is encoded and and stored in the buffer.
An Err result indicates that Self::commit should be called in
order to flush the buffered records to persistent storage.
Sourcepub fn set_epoch(&mut self, epoch: u64)
pub fn set_epoch(&mut self, epoch: u64)
Update the epoch.
The caller must ensure that:
- The new epoch is greater than the current epoch.
Self::commithas been called as appropriate.
Sourcepub fn min_tx_offset(&self) -> u64
pub fn min_tx_offset(&self) -> u64
The smallest transaction offset in this segment.
Sourcepub fn next_tx_offset(&self) -> u64
pub fn next_tx_offset(&self) -> u64
The next transaction offset to be written if Self::commit was called.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Writer<W>where
W: Freeze,
impl<W> RefUnwindSafe for Writer<W>where
W: RefUnwindSafe,
impl<W> Send for Writer<W>where
W: Send,
impl<W> Sync for Writer<W>where
W: Sync,
impl<W> Unpin for Writer<W>where
W: Unpin,
impl<W> UnwindSafe for Writer<W>where
W: UnwindSafe,
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
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