Trait sanakirja_core::Storable
source · pub trait Storable: Debug {
type PageReferences: Iterator<Item = u64>;
// Required method
fn page_references(&self) -> Self::PageReferences;
// Provided methods
fn compare<T: LoadPage>(&self, _txn: &T, _b: &Self) -> Ordering { ... }
unsafe fn drop<T: AllocPage>(&self, txn: &mut T) -> Result<(), T::Error> { ... }
}
Expand description
Types that can be stored on disk. This trait may be used in
conjunction with Sized
in order to determine the on-disk size,
or with UnsizedStorable
when special arrangements are needed.
The size limit for an entry depends on the datastructure. For B trees, nodes are guaranteed to be at least half-full (i.e. at least 2kiB), and we need at least two entries in each page in order to be able to rebalance in a deletion. A sufficient condition for this is that the size of any entry is less than 1/4th of the blocks. Now, internal nodes need 16 bytes of block header, and then 8 extra bytes for each entry. Entries must therefore not exceed 4080/4 - 8 = 1012 bytes.
Required Associated Types§
sourcetype PageReferences: Iterator<Item = u64>
type PageReferences: Iterator<Item = u64>
An iterator over the offsets to pages contained in this
value. Only values from this crate can generate non-empty
iterators, but combined values (like tuples) must chain the
iterators returned by method page_offsets
.
Required Methods§
sourcefn page_references(&self) -> Self::PageReferences
fn page_references(&self) -> Self::PageReferences
If this value is an offset to another page at offset offset
,
return Some(offset)
. Return None
else.