[−][src]Struct shardio::ShardReader
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]
T: DeserializeOwned,
<S as SortKey<T>>::Key: Clone + Ord + DeserializeOwned,
S: SortKey<T>,
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]
shard_files: &[P]
) -> Result<ShardReader<T, S>, Error>
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]
&self,
range: &Range<<S as SortKey<T>>::Key>,
data: &mut Vec<T>
) -> Result<(), Error>
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]
&'a self,
range: &Range<<S as SortKey<T>>::Key>
) -> Result<MergeIterator<'a, T, S>, Error>
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]
&self,
num_chunks: usize,
range: &Range<<S as SortKey<T>>::Key>
) -> Vec<Range<<S as SortKey<T>>::Key>>
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,
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,
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]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,