[][src]Struct extindex::builder::Builder

pub struct Builder<K, V> where
    K: Ord + Encodable<K>,
    V: Encodable<V>, 
{ /* fields omitted */ }

Index builder that creates a file index from any iterator. If the given iterator is already sorted, the build_from_sorted method can be used, while build can take any iterator. The build method will sort the iterator first using external sorting exposed by the extsort crate.

As the index is being built, checkpoints / nodes are added to the file. These checkpoints / nodes are similar to the ones in a skip list, except that they point to previous checkpoints instead of pointing to next checkpoints.

Methods

impl<K, V> Builder<K, V> where
    K: Ord + Encodable<K>,
    V: Encodable<V>, 
[src]

pub fn new(path: PathBuf) -> Builder<K, V>[src]

Create an index builder that will write to the given file path.

pub fn with_log_base(self, log_base: f64) -> Self[src]

Indicate approximately how many items we want per last-level checkpoint. A higher value means that once a checkpoint in which we know the item is after is found, we may need to iterate through up to log_base items. A lower value will prevent creating too many levels when the index gets bigger, but will require more scanning through more entries to find the right one.

Default value: 5.0

pub fn with_extsort_max_size(self, max_size: usize) -> Self[src]

When using the build method from a non-sorted iterator, this value is passed to the extsort crate to define how many items will be buffered to memory before being dumped to disk.

This number is the actual number of entries, not the sum of their size.

pub fn build<I>(self, iter: I) -> Result<(), BuilderError> where
    I: Iterator<Item = Entry<K, V>>, 
[src]

Build the index using a non-sorted iterator.

pub fn build_from_sorted<I>(
    self,
    iter: I,
    nb_items: u64
) -> Result<(), BuilderError> where
    I: Iterator<Item = Entry<K, V>>, 
[src]

Build the index using a sorted iterator.

Auto Trait Implementations

impl<K, V> Send for Builder<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Builder<K, V> where
    K: Sync,
    V: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.