pub struct FileHeader {
pub format_version: u32,
pub block_size: u32,
pub root_a: RootPointer,
pub root_b: RootPointer,
pub active_root: ActiveRoot,
}Expand description
The 4 KB file header for a .luci index file.
Contains magic bytes, format version, block size, two root pointers for
atomic commit, and an active root flag. Serializes to exactly
HEADER_SIZE bytes.
See [[architecture-storage-format#File Layout]].
Fields§
§format_version: u32§block_size: u32§root_a: RootPointer§root_b: RootPointer§active_root: ActiveRootImplementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn active_root_pointer(&self) -> &RootPointer
pub fn active_root_pointer(&self) -> &RootPointer
The currently active root pointer.
Sourcepub fn inactive_root_pointer(&self) -> &RootPointer
pub fn inactive_root_pointer(&self) -> &RootPointer
The inactive root pointer (will be overwritten on next commit).
Sourcepub fn commit(&mut self, metadata_block: BlockId, checksum: u64)
pub fn commit(&mut self, metadata_block: BlockId, checksum: u64)
Prepare the next commit: write new metadata to the inactive root pointer and flip the active flag.
Also re-stamps format_version to the writing binary’s
FORMAT_VERSION. A new binary always writes the current on-disk
formats (e.g. ColumnType::KeywordBlocked), so the header must
advertise the current version even when committing a file created by an
older binary — otherwise an old binary could later open the upgraded
file and silently misread the new column layout ([[code-must-not-lie]]).
This makes any new-binary write a one-way upgrade. The stamp survives
only because SingleFileDirectory::commit is refresh-first (it re-reads
the on-disk header before this flip); see
[[optimization-keyword-dict-offset-index]] and
[[project_hnsw_recall_merge_persist_bug]].
Trait Implementations§
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileHeader
impl Debug for FileHeader
impl Eq for FileHeader
Source§impl PartialEq for FileHeader
impl PartialEq for FileHeader
Source§fn eq(&self, other: &FileHeader) -> bool
fn eq(&self, other: &FileHeader) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FileHeader
Auto Trait Implementations§
impl Freeze for FileHeader
impl RefUnwindSafe for FileHeader
impl Send for FileHeader
impl Sync for FileHeader
impl Unpin for FileHeader
impl UnsafeUnpin for FileHeader
impl UnwindSafe for FileHeader
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> 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§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
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>
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