pub struct Superblock {
pub magic: u64,
pub version: u32,
pub page_size: u32,
pub wal_start_page: u32,
pub wal_head_page: u32,
pub tick_seq: u64,
pub epoch_ms: i64,
}Expand description
Superblock, as it lives in the first SUPERBLOCK_BYTES bytes of page 0.
tick_seq is a publish sequence number, not a timestamp: it counts
publishes from 1 upwards, so two ticks in the same millisecond still get
distinct values. epoch_ms stays for the “when was this last touched”
question, which is a wall-clock question and is answered by the clock.
Fields§
§magic: u64§version: u32§page_size: u32§wal_start_page: u32§wal_head_page: u32§tick_seq: u64§epoch_ms: i64Implementations§
Source§impl Superblock
impl Superblock
pub fn new() -> Self
Sourcepub fn to_payload(&self) -> [u8; 56]
pub fn to_payload(&self) -> [u8; 56]
The published payload. Byte 56..64 of the page is the seqlock counter and is deliberately not part of it, so a rewrite of the payload can never clear the counter out from under a reader.
Sourcepub fn from_payload(buf: &[u8]) -> Option<Self>
pub fn from_payload(buf: &[u8]) -> Option<Self>
None when the page is not a superblock at all. A version other than
the current one is still decoded: magic says whose file this is and
the reader decides what to do with the older fields.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Superblock
impl RefUnwindSafe for Superblock
impl Send for Superblock
impl Sync for Superblock
impl Unpin for Superblock
impl UnsafeUnpin for Superblock
impl UnwindSafe for Superblock
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more