pub struct StoredCommit {
pub min_tx_offset: u64,
pub epoch: u64,
pub n: u16,
pub records: Vec<u8>,
pub checksum: u32,
}
Expand description
Fields§
§min_tx_offset: u64
§epoch: u64
See Commit::epoch
.
n: u16
See Commit::n
.
records: Vec<u8>
See Commit::records
.
checksum: u32
The checksum computed when encoding a Commit
for storage.
Implementations§
Source§impl StoredCommit
impl StoredCommit
Sourcepub fn tx_range(&self) -> Range<u64>
pub fn tx_range(&self) -> Range<u64>
The range of transaction offsets contained in this commit.
Sourcepub fn decode<R: Read>(reader: R) -> Result<Option<Self>>
pub fn decode<R: Read>(reader: R) -> Result<Option<Self>>
Attempt to read one StoredCommit
from the given Read
er.
Returns None
if the reader is already at EOF.
Verifies the checksum of the commit. If it doesn’t match, an error of
kind io::ErrorKind::InvalidData
with an inner error downcastable to
ChecksumMismatch
is returned.
Sourcepub fn into_transactions<D: Decoder>(
self,
version: u8,
from_offset: u64,
de: &D,
) -> impl Iterator<Item = Result<Transaction<D::Record>, D::Error>> + '_
pub fn into_transactions<D: Decoder>( self, version: u8, from_offset: u64, de: &D, ) -> impl Iterator<Item = Result<Transaction<D::Record>, D::Error>> + '_
Convert self
into an iterator yielding Transaction
s.
The supplied Decoder
is responsible for extracting individual
transactions from the records
buffer.
Trait Implementations§
Source§impl Debug for StoredCommit
impl Debug for StoredCommit
Source§impl From<StoredCommit> for Commit
impl From<StoredCommit> for Commit
Source§fn from(_: StoredCommit) -> Self
fn from(_: StoredCommit) -> Self
Converts to this type from the input type.
Source§impl PartialEq for StoredCommit
impl PartialEq for StoredCommit
impl StructuralPartialEq for StoredCommit
Auto Trait Implementations§
impl Freeze for StoredCommit
impl RefUnwindSafe for StoredCommit
impl Send for StoredCommit
impl Sync for StoredCommit
impl Unpin for StoredCommit
impl UnwindSafe for StoredCommit
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