#[repr(C)]pub struct SegmentHeader {Show 14 fields
pub magic: U64,
pub version: U16,
pub start_frame_no: U64,
pub last_commited_frame_no: U64,
pub frame_count: U64,
pub size_after: U32,
pub index_offset: U64,
pub index_size: U64,
pub flags: U32,
pub salt: U32,
pub page_size: U16,
pub log_id: U128,
pub sealed_at_timestamp: U64,
pub header_cheksum: U32,
}
Fields§
§magic: U64
Set to LIBSQL_MAGIC
version: U16
header version
start_frame_no: U64
§last_commited_frame_no: U64
§frame_count: U64
number of frames in the segment
size_after: U32
size of the database in pages, after applying the segment.
index_offset: U64
byte offset of the index. If 0, then the index wasn’t written, and must be recovered. If non-0, the segment is sealed, and must not be written to anymore the index is followed by its checksum
index_size: U64
§flags: U32
§salt: U32
salt for the segment checksum
page_size: U16
right now we only support 4096, but if se decided to support other sizes, we could do it without changing the header
log_id: U128
§sealed_at_timestamp: U64
ms, from unix epoch
header_cheksum: U32
checksum of the header fields, excluding the checksum itself. This field must be the last
Implementations§
Source§impl SegmentHeader
impl SegmentHeader
pub fn flags(&self) -> SegmentFlags
pub fn last_commited_frame_no(&self) -> u64
Sourcepub fn size_after(&self) -> u32
pub fn size_after(&self) -> u32
size fo the db after applying this segment
pub fn frame_count(&self) -> usize
pub fn last_committed(&self) -> u64
Trait Implementations§
Source§impl AsBytes for SegmentHeader
impl AsBytes for SegmentHeader
Source§impl Clone for SegmentHeader
impl Clone for SegmentHeader
Source§fn clone(&self) -> SegmentHeader
fn clone(&self) -> SegmentHeader
Returns a duplicate of the value. Read more
1.0.0 · 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 SegmentHeader
impl Debug for SegmentHeader
Source§impl FromBytes for SegmentHeader
impl FromBytes for SegmentHeader
Source§fn mut_from_prefix(bytes: &mut [u8]) -> Option<&mut Self>
fn mut_from_prefix(bytes: &mut [u8]) -> Option<&mut Self>
Source§fn mut_from_suffix(bytes: &mut [u8]) -> Option<&mut Self>
fn mut_from_suffix(bytes: &mut [u8]) -> Option<&mut Self>
Source§fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
Interprets the prefix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read moreSource§fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
Interprets the suffix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read moreSource§fn mut_slice_from(bytes: &mut [u8]) -> Option<&mut [Self]>
fn mut_slice_from(bytes: &mut [u8]) -> Option<&mut [Self]>
Source§fn mut_slice_from_prefix(
bytes: &mut [u8],
count: usize,
) -> Option<(&mut [Self], &mut [u8])>
fn mut_slice_from_prefix( bytes: &mut [u8], count: usize, ) -> Option<(&mut [Self], &mut [u8])>
Interprets the prefix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read moreSource§fn mut_slice_from_suffix(
bytes: &mut [u8],
count: usize,
) -> Option<(&mut [u8], &mut [Self])>
fn mut_slice_from_suffix( bytes: &mut [u8], count: usize, ) -> Option<(&mut [u8], &mut [Self])>
Interprets the suffix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read moreSource§impl FromZeroes for SegmentHeader
impl FromZeroes for SegmentHeader
Source§fn new_zeroed() -> Selfwhere
Self: Sized,
fn new_zeroed() -> Selfwhere
Self: Sized,
Creates an instance of
Self
from zeroed bytes. Read moreSource§fn new_box_zeroed() -> Box<Self>where
Self: Sized,
fn new_box_zeroed() -> Box<Self>where
Self: Sized,
Creates a
Box<Self>
from zeroed bytes. Read moreimpl Copy for SegmentHeader
Auto Trait Implementations§
impl Freeze for SegmentHeader
impl RefUnwindSafe for SegmentHeader
impl Send for SegmentHeader
impl Sync for SegmentHeader
impl Unpin for SegmentHeader
impl UnwindSafe for SegmentHeader
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreCreates a shared type from an unshared type.