public final class Pump extends Object
Constructor and Description |
---|
Pump() |
Modifier and Type | Method and Description |
---|---|
static <E,K,V> long |
buildTreeMap(Iterator<E> source,
Engine engine,
Fun.Function1<K,E> keyExtractor,
Fun.Function1<V,E> valueExtractor,
boolean ignoreDuplicates,
int nodeSize,
boolean valuesStoredOutsideNodes,
long counterRecid,
BTreeKeySerializer<K> keySerializer,
Serializer<V> valueSerializer,
Comparator comparator)
Build BTreeMap (or TreeSet) from presorted data.
|
static <E> Iterator<E> |
merge(Iterator... iters)
Merges multiple iterators into single iterator.
|
static <E> Iterator<E> |
sort(Comparator comparator,
boolean mergeDuplicates,
Iterator... iterators)
Merge presorted iterators into single sorted iterator.
|
static <E> Iterator<E> |
sort(Iterator<E> source,
boolean mergeDuplicates,
int batchSize,
Comparator comparator,
Serializer serializer)
Sorts large data set by given `Comparator`.
|
public static <E> Iterator<E> sort(Iterator<E> source, boolean mergeDuplicates, int batchSize, Comparator comparator, Serializer serializer)
source
- iterator over unsorted datamergeDuplicates
- should be duplicate keys merged into single one?batchSize
- how much items can fit into heap memorycomparator
- used to sort dataserializer
- used to store data in temporary filespublic static <E> Iterator<E> sort(Comparator comparator, boolean mergeDuplicates, Iterator... iterators)
comparator
- used to compare datamergeDuplicates
- if duplicate keys should be merged into single oneiterators
- array of already sorted iteratorspublic static <E> Iterator<E> merge(Iterator... iters)
iters
- - iterators to be mergedpublic static <E,K,V> long buildTreeMap(Iterator<E> source, Engine engine, Fun.Function1<K,E> keyExtractor, Fun.Function1<V,E> valueExtractor, boolean ignoreDuplicates, int nodeSize, boolean valuesStoredOutsideNodes, long counterRecid, BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator comparator)
sort(java.util.Iterator, boolean, int, java.util.Comparator, Serializer)
This method does not call commit. You should disable Write Ahead Log when this method is used DBMaker.transactionDisable()
source
- iterator over source data, must be reverse sortedkeyExtractor
- transforms items from source iterator into keys. If null source items will be used directly as keys.valueExtractor
- transforms items from source iterator into values. If null BTreeMap will be constructed without values (as Set)ignoreDuplicates
- should be duplicate keys merged into single one?nodeSize
- maximal BTree node size before it is splited.valuesStoredOutsideNodes
- if true values will not be stored as part of BTree nodescounterRecid
- TODO make size counter friendly to usekeySerializer
- serializer for keys, use null for default valuevalueSerializer
- serializer for value, use null for default valuecomparator
- comparator used to compare keys, use null for 'comparable comparator'IllegalArgumentException
- if source iterator is not reverse sortedCopyright © 2014. All Rights Reserved.