Struct ext_sort::sort::ExternalSorter
source ·
[−]pub struct ExternalSorter<T, E, B = LimitedBufferBuilder, C = RmpExternalChunk<T>> where
T: Send,
E: Error,
B: ChunkBufferBuilder<T>,
C: ExternalChunk<T>, { /* fields omitted */ }Expand description
External sorter.
Implementations
impl<T, E, B, C> ExternalSorter<T, E, B, C> where
T: Send,
E: Error,
B: ChunkBufferBuilder<T>,
C: ExternalChunk<T>,
impl<T, E, B, C> ExternalSorter<T, E, B, C> where
T: Send,
E: Error,
B: ChunkBufferBuilder<T>,
C: ExternalChunk<T>,
Creates a new external sorter instance.
Arguments
threads_number- Number of threads to be used to sort data in parallel. If the parameter isNonethreads number will be selected based on available CPU core number.tmp_path- Directory to be used to store temporary data. If paramater isNonedefault OS temporary directory will be used.buffer_builder- An instance of a buffer builder that will be used for chunk buffer creation.rw_buf_size- Chunks file read/write buffer size.
pub fn sort<I>(
&self,
input: I
) -> Result<BinaryHeapMerger<T, C::DeserializationError, impl Fn(&T, &T) -> Ordering + Copy, C>, SortError<C::SerializationError, C::DeserializationError, E>> where
T: Ord,
I: IntoIterator<Item = Result<T, E>>,
pub fn sort<I>(
&self,
input: I
) -> Result<BinaryHeapMerger<T, C::DeserializationError, impl Fn(&T, &T) -> Ordering + Copy, C>, SortError<C::SerializationError, C::DeserializationError, E>> where
T: Ord,
I: IntoIterator<Item = Result<T, E>>,
Sorts data from the input. Returns an iterator that can be used to get sorted data stream.
Arguments
input- Input stream data to be fetched from
pub fn sort_by<I, F>(
&self,
input: I,
compare: F
) -> Result<BinaryHeapMerger<T, C::DeserializationError, F, C>, SortError<C::SerializationError, C::DeserializationError, E>> where
I: IntoIterator<Item = Result<T, E>>,
F: Fn(&T, &T) -> Ordering + Sync + Send + Copy,
pub fn sort_by<I, F>(
&self,
input: I,
compare: F
) -> Result<BinaryHeapMerger<T, C::DeserializationError, F, C>, SortError<C::SerializationError, C::DeserializationError, E>> where
I: IntoIterator<Item = Result<T, E>>,
F: Fn(&T, &T) -> Ordering + Sync + Send + Copy,
Sorts data from the input using a custom compare function. Returns an iterator that can be used to get sorted data stream.
Arguments
input- Input stream data to be fetched fromcompare- Function be be used to compare items
