pub struct RecordRef<'a> {
pub len: u32,
pub kind: u8,
pub flags: u8,
pub prev: u64,
pub ttl_ms: Option<u64>,
pub key: &'a [u8],
pub value: &'a [u8],
}Expand description
A record read back out of a page.
Fields§
§len: u32The exact length, header and trailer included.
kind: u8The raw kind byte. Use RecordRef::kind to ask what it means.
flags: u8See record_flags.
prev: u64The previous address in this key’s chain, or 0.
ttl_ms: Option<u64>Unix milliseconds, or None if the record has no TTL.
key: &'a [u8]The key, borrowed from the page.
value: &'a [u8]The value, borrowed from the page.
Implementations§
Source§impl<'a> RecordRef<'a>
impl<'a> RecordRef<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Option<RecordRef<'a>>>
pub fn parse(bytes: &'a [u8]) -> Result<Option<RecordRef<'a>>>
Parses the record at the front of bytes.
Ok(None) means len was zero, which is the end of the log and not an
error. That is the normal way replay finishes (06 section 4) and it is
also what a half written tail looks like, which is exactly the point:
the two are indistinguishable and both mean stop here.
§Errors
Code::Corrupt if the length is impossible, if the record runs past
the end of bytes, or if a checksummed record fails its checksum.
Sourcepub fn stride(&self) -> usize
pub fn stride(&self) -> usize
How far the next record is, which is RecordRef::len rounded up to
eight.
Walk by this and not by len.
Sourcepub fn kind(&self) -> Option<RecordKind>
pub fn kind(&self) -> Option<RecordKind>
The kind, if this version knows it.
None is not an error. It means a newer writer put something here and
len says how far to jump to get past it.
Sourcepub fn is_tombstone(&self) -> bool
pub fn is_tombstone(&self) -> bool
Whether this record deletes its key.