pub struct OrdinalTable { /* private fields */ }Expand description
The live store’s ordinal space: a sorted base, then arrivals appended.
Owned; Self::view is the lookup. See the module header for why it is
append-only.
Implementations§
Source§impl OrdinalTable
impl OrdinalTable
pub fn empty(oid_len: usize) -> Self
Sourcepub fn from_sorted(raw: Vec<u8>, oid_len: usize) -> Self
pub fn from_sorted(raw: Vec<u8>, oid_len: usize) -> Self
A fresh table over a sorted full oid list: base only, nothing appended.
Sourcepub fn from_parts(
full_sorted: &[u8],
extra: &[u8],
oid_len: usize,
) -> Option<Self>
pub fn from_parts( full_sorted: &[u8], extra: &[u8], oid_len: usize, ) -> Option<Self>
The persisted form, replayed: full_sorted is the store’s current sorted
oid list and extra the appended part in arrival order. The base is
full − extra. None when the two do not agree (an oid in extra that
the store no longer holds, or a width mismatch) — rebuild from scratch.
Sourcepub fn from_base_and_extra(
base: Vec<u8>,
extra: Vec<u8>,
oid_len: usize,
) -> Option<Self>
pub fn from_base_and_extra( base: Vec<u8>, extra: Vec<u8>, oid_len: usize, ) -> Option<Self>
The persisted form, replayed from the two raw parts: base must be
sorted and distinct (the binary search rests on it), extra distinct
and disjoint from it. None otherwise — a malformed file is a rebuild,
never a wrong ordinal.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn oid_len(&self) -> usize
pub fn base_len(&self) -> usize
Sourcepub fn extra_raw(&self) -> &[u8] ⓘ
pub fn extra_raw(&self) -> &[u8] ⓘ
The appended part, arrival order — what the persisted form stores.
pub fn view(&self) -> OrdinalSpace<'_>
Sourcepub fn follow(&mut self, full_sorted: &[u8]) -> Option<Range<u32>>
pub fn follow(&mut self, full_sorted: &[u8]) -> Option<Range<u32>>
Follow the store: full_sorted is every oid the store holds now, in
sorted order. Every oid in it that this table does not number is
appended (in sorted order among themselves, after everything already
numbered) and the range of new ordinals is returned. None when an oid
the table numbers is absent from full_sorted — something was
removed under the table (a gc, a retain) and the numbering cannot be
kept; the caller rebuilds from scratch.