[][src]Struct shardio::ShardReader

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.

Methods

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 not 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

Auto Trait Implementations

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

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<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.