Struct spacetimedb_commitlog::Commit
source · pub struct Commit {
pub min_tx_offset: u64,
pub n: u16,
pub records: Vec<u8>,
}
Expand description
Entry type of a crate::Commitlog
.
Fields§
§min_tx_offset: u64
The offset of the first record in this commit.
The offset starts from zero and is counted from the beginning of the entire log.
n: u16
The number of records in the commit.
records: Vec<u8>
A buffer of all records in the commit in serialized form.
Readers must bring their own crate::Decoder
to interpret this buffer.
n
indicates how many records the buffer contains.
Implementations§
source§impl Commit
impl Commit
pub const FRAMING_LEN: usize = 18usize
pub const CHECKSUM_ALGORITHM: u8 = 0u8
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 encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Length in bytes of this commit when written to the log via Self::write
.
sourcepub fn decode<R: Read>(reader: R) -> Result<Option<Self>>
pub fn decode<R: Read>(reader: R) -> Result<Option<Self>>
Attempt to read one Commit
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.
pub fn into_transactions<D: Decoder>( self, version: u8, de: &D ) -> impl Iterator<Item = Result<Transaction<D::Record>, D::Error>> + '_
Trait Implementations§
source§impl PartialEq for Commit
impl PartialEq for Commit
impl StructuralPartialEq for Commit
Auto Trait Implementations§
impl Freeze for Commit
impl RefUnwindSafe for Commit
impl Send for Commit
impl Sync for Commit
impl Unpin for Commit
impl UnwindSafe for Commit
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
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