public class InMemoryBTreeBuilder<K,V>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private InMemoryBTreeConfiguration<K,V> |
btreeConfiguration
The Btree configuration
|
| Constructor and Description |
|---|
InMemoryBTreeBuilder(InMemoryBTreeConfiguration<K,V> btreeConfiguration)
Creates a new instance of InMemoryBTreeBuilder.
|
InMemoryBTreeBuilder(java.lang.String name,
int numKeysInNode,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer)
Creates a new instance of InMemoryBTreeBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
private int |
add(BTree<K,V> btree,
Page<K,V>[] pageStack,
int level,
Page<K,V> page,
Tuple<K,V> tuple) |
private Page<K,V> |
addLeaves(BTree<K,V> btree,
java.util.List<Tuple<K,V>> tuples,
int maxElements)
Creates all the leaves using the provided tuples, and update the upper layer if needed
|
private Page<K,V> |
attachNodes(java.util.List<Page<K,V>> children,
BTree<K,V> btree) |
BTree<K,V> |
build(java.util.Iterator<Tuple<K,V>> sortedTupleItr) |
private InMemoryNode<K,V> |
createParentNode(BTree<K,V> btree,
java.util.List<InMemoryNode<K,V>> nodes,
int maxElements)
Creates all the nodes using the provided node pages, and update the upper laye
|
private void |
injectTuple(BTree<K,V> btree,
InMemoryLeaf<K,V> leaf,
int leafPos,
Tuple<K,V> tuple) |
private InMemoryBTreeConfiguration<K,V> btreeConfiguration
public InMemoryBTreeBuilder(java.lang.String name,
int numKeysInNode,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer)
name - The BTree namenumKeysInNode - The number of keys per nodekeySerializer - The key serializervalueSerializer - The value serializerpublic InMemoryBTreeBuilder(InMemoryBTreeConfiguration<K,V> btreeConfiguration)
btreeConfiguration - The Btree configurationpublic BTree<K,V> build(java.util.Iterator<Tuple<K,V>> sortedTupleItr) throws java.io.IOException
java.io.IOExceptionprivate InMemoryNode<K,V> createParentNode(BTree<K,V> btree, java.util.List<InMemoryNode<K,V>> nodes, int maxElements)
private Page<K,V> addLeaves(BTree<K,V> btree, java.util.List<Tuple<K,V>> tuples, int maxElements)
private void injectTuple(BTree<K,V> btree, InMemoryLeaf<K,V> leaf, int leafPos, Tuple<K,V> tuple)
private int add(BTree<K,V> btree, Page<K,V>[] pageStack, int level, Page<K,V> page, Tuple<K,V> tuple)