Documentation of 'org.mapdb.Pump' Java class
Pump
org.mapdb

Class Pump



  • public final class Pump
    extends java.lang.Object
    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

      Constructors 
      Constructor and Description
      Pump() 
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      static void archiveTreeMap(java.util.Iterator<Fun.Pair> source, java.lang.String file, Volume.VolumeFactory factory, DB.BTreeMapMaker config) 
      static void archiveTreeMap(java.util.NavigableMap source, java.io.File target, DB.BTreeMapMaker config) 
      static void backupFull(DB db, java.io.OutputStream out) 
      static DB backupFullRestore(DBMaker.Maker maker, java.io.InputStream in) 
      static void backupIncremental(DB db, java.io.File backupDir) 
      static DB backupIncrementalRestore(DBMaker.Maker maker, java.io.File backupDir) 
      static <E,K,V> long buildTreeMap(java.util.Iterator<E> source, Engine engine, Fun.Function1<K,E> keyExtractor, Fun.Function1<V,E> valueExtractor, boolean ignoreDuplicates, int nodeSize, boolean valuesStoredOutsideNodes, long counterRecid, BTreeKeySerializer keySerializer, Serializer<V> valueSerializer, java.util.concurrent.Executor executor)
      Build BTreeMap (or TreeSet) from presorted data.
      static void copy(DB src, DB target)
      Deprecated. 
      not yet implemented
      static <K,V,A> void fillHTreeMap(HTreeMap<K,V> m, java.util.Iterator<A> pumpSource, Fun.Function1<K,A> pumpKeyExtractor, Fun.Function1<V,A> pumpValueExtractor, int pumpPresortBatchSize, boolean pumpIgnoreDuplicates, Serializer<A> sortSerializer, java.util.concurrent.Executor executor) 
      static <E> java.util.Iterator<E> merge(java.util.concurrent.Executor executor, java.util.Iterator... iters)
      Merges multiple iterators into single iterator.
      static <E> java.util.Iterator<E> poisonPillIterator(java.util.concurrent.BlockingQueue<E> q, java.lang.Object poisonPill) 
      static <E> java.util.Iterator<E> sort(java.util.Comparator<E> comparator, boolean mergeDuplicates, java.util.Iterator<E>... iterators)
      Merge presorted iterators into single sorted iterator.
      static <E> java.util.Iterator<E> sort(java.util.Iterator<E> source, boolean mergeDuplicates, int batchSize, java.util.Comparator comparator, Serializer<E> serializer, java.util.concurrent.Executor executor)
      Sorts large data set by given Comparator.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pump

        public Pump()
    • Method Detail

      • sort

        public static <E> java.util.Iterator<E> sort(java.util.Iterator<E> source,
                                                     boolean mergeDuplicates,
                                                     int batchSize,
                                                     java.util.Comparator comparator,
                                                     Serializer<E> serializer,
                                                     java.util.concurrent.Executor executor)
        Sorts large data set by given Comparator. Data are sorted with in-memory cache and temporary files.
        Parameters:
        source - iterator over unsorted data
        mergeDuplicates - should be duplicate keys merged into single one?
        batchSize - how much items can fit into heap memory
        comparator - used to sort data
        serializer - used to store data in temporary files
        Returns:
        iterator over sorted data set
      • sort

        public static <E> java.util.Iterator<E> sort(java.util.Comparator<E> comparator,
                                                     boolean mergeDuplicates,
                                                     java.util.Iterator<E>... iterators)
        Merge presorted iterators into single sorted iterator.
        Parameters:
        comparator - used to compare data
        mergeDuplicates - if duplicate keys should be merged into single one
        iterators - array of already sorted iterators
        Returns:
        sorted iterator
      • merge

        public static <E> java.util.Iterator<E> merge(java.util.concurrent.Executor executor,
                                                      java.util.Iterator... iters)
        Merges multiple iterators into single iterator. Result iterator will return entries from all iterators. It does not do sorting or any other special functionality. Does not allow null elements.
        Parameters:
        iters - - iterators to be merged
        Returns:
        union of all iterators.
      • poisonPillIterator

        public static <E> java.util.Iterator<E> poisonPillIterator(java.util.concurrent.BlockingQueue<E> q,
                                                                   java.lang.Object poisonPill)
      • buildTreeMap

        public static <E,K,V> long buildTreeMap(java.util.Iterator<E> source,
                                                Engine engine,
                                                Fun.Function1<K,E> keyExtractor,
                                                Fun.Function1<V,E> valueExtractor,
                                                boolean ignoreDuplicates,
                                                int nodeSize,
                                                boolean valuesStoredOutsideNodes,
                                                long counterRecid,
                                                BTreeKeySerializer keySerializer,
                                                Serializer<V> valueSerializer,
                                                java.util.concurrent.Executor executor)
        Build BTreeMap (or TreeSet) from presorted data. This method is much faster than usual import using Map.put(key,value) method. It is because tree integrity does not have to be maintained and tree can be created in linear way with. This method expect data to be presorted in **reverse order** (highest to lowest). There are technical reason for this requirement. To sort unordered data use sort(java.util.Iterator, boolean, int, java.util.Comparator, Serializer, Executor) This method does not call commit. You should disable Write Ahead Log when this method is used DBMaker.Maker.transactionDisable()
        Parameters:
        source - iterator over source data, must be reverse sorted
        keyExtractor - 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 nodes
        counterRecid - TODO make size counter friendly to use
        keySerializer - serializer for keys, use null for default value
        valueSerializer - serializer for value, use null for default value
        Throws:
        DBException.PumpSourceNotSorted - if source iterator is not reverse sorted
        DBException.PumpSourceDuplicate - if source iterator has duplicates
      • fillHTreeMap

        public static <K,V,A> void fillHTreeMap(HTreeMap<K,V> m,
                                                java.util.Iterator<A> pumpSource,
                                                Fun.Function1<K,A> pumpKeyExtractor,
                                                Fun.Function1<V,A> pumpValueExtractor,
                                                int pumpPresortBatchSize,
                                                boolean pumpIgnoreDuplicates,
                                                Serializer<A> sortSerializer,
                                                java.util.concurrent.Executor executor)
      • copy

        public static void copy(DB src,
                                DB target)
        Deprecated. not yet implemented
      • backupFull

        public static void backupFull(DB db,
                                      java.io.OutputStream out)
      • backupFullRestore

        public static DB backupFullRestore(DBMaker.Maker maker,
                                           java.io.InputStream in)
      • backupIncremental

        public static void backupIncremental(DB db,
                                             java.io.File backupDir)
      • backupIncrementalRestore

        public static DB backupIncrementalRestore(DBMaker.Maker maker,
                                                  java.io.File backupDir)
      • archiveTreeMap

        public static void archiveTreeMap(java.util.NavigableMap source,
                                          java.io.File target,
                                          DB.BTreeMapMaker config)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.