Struct shardio::ShardReader[][src]

pub struct ShardReader<T, S = DefaultSort> where
    S: SortKey<T>, 
{ /* fields omitted */ }

Read from a collection of shardio files. The input data is merged to give a single sorted view of the combined dataset. The input files must be created with the same sort order S as they are read with.

Implementations

impl<T, S> ShardReader<T, S> where
    T: DeserializeOwned,
    <S as SortKey<T>>::Key: Clone + Ord + DeserializeOwned,
    S: SortKey<T>, 
[src]

pub fn open<P: AsRef<Path>>(shard_file: P) -> Result<ShardReader<T, S>, Error>[src]

Open a single shard files into reader

pub fn open_set<P: AsRef<Path>>(
    shard_files: &[P]
) -> Result<ShardReader<T, S>, Error>
[src]

Open a set of shard files into an aggregated reader

pub fn read_range(
    &self,
    range: &Range<<S as SortKey<T>>::Key>,
    data: &mut Vec<T>
) -> Result<(), Error>
[src]

Read data from the given range into data buffer. The data buffer is cleared before adding items.

pub fn iter_range<'a>(
    &'a self,
    range: &Range<<S as SortKey<T>>::Key>
) -> Result<MergeIterator<'a, T, S>, Error>
[src]

Iterate over items in the given range

pub fn iter<'a>(&'a self) -> Result<MergeIterator<'a, T, S>, Error>[src]

Iterate over all items

pub fn len(&self) -> usize[src]

Total number of items

pub fn make_chunks(
    &self,
    num_chunks: usize,
    range: &Range<<S as SortKey<T>>::Key>
) -> Vec<Range<<S as SortKey<T>>::Key>>
[src]

Generate num_chunks ranges covering the give range, each with a roughly equal numbers of elements. The ranges can be fed to iter_range

pub fn est_len_range(&self, range: &Range<<S as SortKey<T>>::Key>) -> usize[src]

Estimate an upper bound on the total number of values held by a range

Auto Trait Implementations

impl<T, S> RefUnwindSafe for ShardReader<T, S> where
    T: RefUnwindSafe,
    <S as SortKey<T>>::Key: RefUnwindSafe

impl<T, S> Send for ShardReader<T, S> where
    T: Send,
    <S as SortKey<T>>::Key: Send

impl<T, S> Sync for ShardReader<T, S> where
    T: Sync,
    <S as SortKey<T>>::Key: Sync

impl<T, S> Unpin for ShardReader<T, S> where
    T: Unpin,
    <S as SortKey<T>>::Key: Unpin

impl<T, S> UnwindSafe for ShardReader<T, S> where
    T: UnwindSafe,
    <S as SortKey<T>>::Key: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.