pub struct Directory { /* private fields */ }Expand description
In-memory directory covering all posting blocks for a dimension.
Unlike DirectoryBlock (a single on-disk part limited to u16
entries), Directory holds the complete (max_offset, max_weight)
list with no size restriction. It is the owner on both the write
and read paths:
- Write: accumulate entries, then call [
into_parts] to produceVec<DirectoryBlock>sized for the blockfile. - Read: load
DirectoryBlockparts, then call [from_parts] to get back the fullDirectory.
Implementations§
Source§impl Directory
impl Directory
Sourcepub fn new(
max_offsets: Vec<u32>,
max_weights: Vec<f32>,
) -> Result<Self, SparsePostingBlockError>
pub fn new( max_offsets: Vec<u32>, max_weights: Vec<f32>, ) -> Result<Self, SparsePostingBlockError>
Create a directory from per-posting-block metadata.
Sourcepub fn from_parts(
parts: impl IntoIterator<Item = DirectoryBlock>,
) -> Result<Self, SparsePostingBlockError>
pub fn from_parts( parts: impl IntoIterator<Item = DirectoryBlock>, ) -> Result<Self, SparsePostingBlockError>
Reconstruct a directory from on-disk DirectoryBlock parts.
Sourcepub fn into_parts(self, max_entries_per_part: usize) -> Vec<DirectoryBlock>
pub fn into_parts(self, max_entries_per_part: usize) -> Vec<DirectoryBlock>
Split into DirectoryBlock parts that each fit within a
block-size budget.
Use [max_entries_for_block_size] to derive max_entries_per_part
from the blockfile’s max_block_size_bytes.
pub fn max_offsets(&self) -> &[u32]
pub fn max_weights(&self) -> &[f32]
Sourcepub fn dim_max_weight(&self) -> f32
pub fn dim_max_weight(&self) -> f32
Dimension-level maximum weight (max of all per-block max_weights).
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Number of posting blocks summarized.
Sourcepub fn max_entries_for_block_size(max_block_size_bytes: usize) -> usize
pub fn max_entries_for_block_size(max_block_size_bytes: usize) -> usize
Maximum directory entries per DirectoryBlock part that fit
within max_block_size_bytes.
Each entry is 8 bytes (u32 offset + f32 weight) plus a 16-byte header per part. A fixed headroom is reserved for Arrow per-row overhead (offset buffers, prefix/key columns, alignment padding).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Directory
impl RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl UnsafeUnpin for Directory
impl UnwindSafe for Directory
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<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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.