org.apache.directory.mavibot.btree

## Class BulkLoader<K,V>

- java.lang.Object
- - org.apache.directory.mavibot.btree.BulkLoader<K,V>

-     public class BulkLoader<K,V>
      extends Object

  A class used to bulk load a BTree. It will allow the load of N elements in a given BTree without to have to inject one by one, saving a lot of time. The second advantage is that the btree will be dense (the leaves will be complete, except the last one). This class can also be used to compact a BTree.
  Author:
    Apache Directory Project

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BTree<?,?>` | `compact(BTree<?,?> btree)` Compact a given in-memory BTree, making it dense.
    `static void` | `compact(RecordManager recordManager, BTree<?,?> btree)` Compact a given persisted BTree, making it dense.
    `static <K,V> BTree<K,V>` | `load(BTree<K,V> btree, Iterator<Tuple<K,V>> iterator, int chunkSize)` Bulk Load data into a persisted BTree

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### load

          public static <K,V> BTree<K,V> load(BTree<K,V> btree,
                              Iterator<Tuple<K,V>> iterator,
                              int chunkSize)
                                 throws IOException

      Bulk Load data into a persisted BTree
      Parameters:
        `btree` - The persisted BTree in which we want to load the data
        `iterator` - The iterator over the data to bulkload
        `chunkSize` - The number of elements we may store in memory at each iteration
      Throws:
        `IOException` - If there is a problem while processing the data

    - #### compact

          public static void compact(RecordManager recordManager,
                     BTree<?,?> btree)

      Compact a given persisted BTree, making it dense. All the values will be stored in newly created pages, each one of them containing as much elements as it's size. The RecordManager will be stopped and restarted, do not use this method on a running BTree.
      Parameters:
        `recordManager` - The associated recordManager
        `btree` - The BTree to compact

    - #### compact

          public static BTree<?,?> compact(BTree<?,?> btree)
                                    throws IOException,
                                           KeyNotFoundException

      Compact a given in-memory BTree, making it dense. All the values will be stored in newly created pages, each one of them containing as much elements as it's size.
      Parameters:
        `btree` - The BTree to compact
      Throws:
        `KeyNotFoundException`
        `IOException`

Copyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.