pub struct HeaderNode {
pub tsn: Tsn,
pub free_lists_tree_root_id: PageID,
pub events_tree_root_id: PageID,
pub tags_tree_root_id: PageID,
pub next_page_id: PageID,
pub next_position: Position,
pub schema_version: u32,
pub tracking_root_page_id: PageID,
}Fields§
§tsn: Tsn§free_lists_tree_root_id: PageID§events_tree_root_id: PageID§next_page_id: PageID§next_position: Position§schema_version: u32On-disk schema version for the header node
tracking_root_page_id: PageIDImplementations§
Source§impl HeaderNode
impl HeaderNode
Sourcepub fn calc_serialized_size(&self) -> usize
pub fn calc_serialized_size(&self) -> usize
Writes the serialized HeaderNode into the provided buffer and returns the number of bytes written (52). The buffer must be at least 52 bytes long.
pub fn serialize_into(&self, buf: &mut [u8]) -> DcbResult<usize>
Sourcepub fn from_slice(slice: &[u8]) -> DcbResult<Self>
pub fn from_slice(slice: &[u8]) -> DcbResult<Self>
Deserializes a HeaderNode from a byte slice.
This function is strictly backward-compatible. It accepts legacy 48-byte layouts
and dynamically defaults newer fields to 0 or empty if the provided slice
is shorter than the current schema.
§Byte Layout
Core Header (Required - 48 bytes):
00..08:tsn(u64)08..16:next_page_id(u64)16..24:free_lists_tree_root_id(u64)24..32:events_tree_root_id(u64)32..40:tags_tree_root_id(u64)40..48:next_position(u64)
Extensions (Optional):
48..52:schema_version(u32, defaults to 0)52..54:flags(u16, defaults to empty)54..62:tracking_root_page_id(u64, parsed only ifHAS_TRACKING_ROOT_IDflag is set, defaults to 0)
§Arguments
slice- The byte slice containing the serialized header data.
§Errors
Returns a DcbError::DeserializationError if:
- The slice is smaller than the core 48 bytes.
- Unrecognized bits are set in the
flagsfield. - The
HAS_TRACKING_ROOT_IDflag is present, but the slice is too short to contain the 8-byte ID.
Trait Implementations§
Source§impl Clone for HeaderNode
impl Clone for HeaderNode
Source§fn clone(&self) -> HeaderNode
fn clone(&self) -> HeaderNode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HeaderNode
impl Debug for HeaderNode
Source§impl Default for HeaderNode
impl Default for HeaderNode
impl Eq for HeaderNode
Source§impl PartialEq for HeaderNode
impl PartialEq for HeaderNode
impl StructuralPartialEq for HeaderNode
Auto Trait Implementations§
impl Freeze for HeaderNode
impl RefUnwindSafe for HeaderNode
impl Send for HeaderNode
impl Sync for HeaderNode
impl Unpin for HeaderNode
impl UnsafeUnpin for HeaderNode
impl UnwindSafe for HeaderNode
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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