|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.Pump
public final class Pump
Data Pump moves data from one source to other. It can be used to import data from text file, or copy store from memory to disk.
| Constructor Summary | |
|---|---|
Pump()
|
|
| Method Summary | ||
|---|---|---|
static
|
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
|
merge(Iterator... iters)
Merges multiple iterators into single iterator. |
|
static
|
sort(Comparator comparator,
boolean mergeDuplicates,
Iterator... iterators)
Merge presorted iterators into single sorted iterator. |
|
static
|
sort(Iterator<E> source,
boolean mergeDuplicates,
int batchSize,
Comparator comparator,
Serializer serializer)
Sorts large data set by given `Comparator`. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Pump()
| Method Detail |
|---|
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 files
public 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 iterators
public static <E> Iterator<E> merge(Iterator... iters)
iters - - iterators to be merged
public 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 sorted
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||