K - The B-tree key typeV - The B-tree value typepublic class BTreeFactory<K,V>
extends java.lang.Object
| Constructor and Description |
|---|
BTreeFactory() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> BTree<K,V> |
createInMemoryBTree()
Creates a new in-memory B-tree, with no initialization.
|
static <K,V> BTree<K,V> |
createInMemoryBTree(InMemoryBTreeConfiguration<K,V> configuration)
Creates a new in-memory B-tree using the BTreeConfiguration to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
boolean allowDuplicates)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
java.lang.String filePath,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
java.lang.String filePath,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createInMemoryBTree(java.lang.String name,
java.lang.String filePath,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize,
boolean allowDuplicates)
Creates a new in-memory B-tree using the parameters to initialize the
B-tree
|
(package private) static <K,V> Page<K,V> |
createLeaf(BTree<K,V> btree,
long revision,
int nbElems)
Create a new Leaf for the given B-tree.
|
(package private) static <K,V> Page<K,V> |
createNode(BTree<K,V> btree,
long revision,
int nbElems)
Create a new Node for the given B-tree.
|
static <K,V> BTree<K,V> |
createPersistedBTree()
Creates a new persisted B-tree, with no initialization.
|
static <K,V> BTree<K,V> |
createPersistedBTree(BTreeTypeEnum type)
Creates a new persisted B-tree, with no initialization.
|
static <K,V> BTree<K,V> |
createPersistedBTree(PersistedBTreeConfiguration<K,V> configuration)
Creates a new persisted B-tree using the BTreeConfiguration to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
boolean allowDuplicates)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
boolean allowDuplicates,
int cacheSize)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize,
boolean allowDuplicates)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
static <K,V> BTree<K,V> |
createPersistedBTree(java.lang.String name,
ElementSerializer<K> keySerializer,
ElementSerializer<V> valueSerializer,
int pageSize,
boolean allowDuplicates,
int cacheSize)
Creates a new persisted B-tree using the parameters to initialize the
B-tree
|
(package private) static <K,V> java.util.LinkedList<ParentPos<K,V>> |
getPathToLeftMostLeaf(BTree<K,V> btree)
Includes the intermediate nodes in the path up to and including the left most leaf of the tree
|
(package private) static <K,V> java.util.LinkedList<ParentPos<K,V>> |
getPathToRightMostLeaf(BTree<K,V> btree)
Includes the intermediate nodes in the path up to and including the right most leaf of the tree
|
(package private) static <K,V> Page<K,V> |
getRootPage(BTree<K,V> btree)
Return the B-tree root page
|
static <K,V> void |
setBtreeHeaderOffset(PersistedBTree<K,V> btree,
long btreeHeaderOffset)
Sets the btreeHeader offset for a Persisted BTree
|
(package private) static <K,V> void |
setKey(BTree<K,V> btree,
Page<K,V> page,
int pos,
byte[] buffer)
Set the key at a give position
|
(package private) static <K,V> void |
setKey(BTree<K,V> btree,
Page<K,V> page,
int pos,
K key)
Set the key at a give position
|
(package private) static <K,V> void |
setKeySerializer(BTree<K,V> btree,
java.lang.String keySerializerFqcn)
Sets the KeySerializer into the B-tree
|
(package private) static <K,V> void |
setName(BTree<K,V> btree,
java.lang.String name)
Set the B-tree name
|
(package private) static <K,V> void |
setNbElems(BTree<K,V> btree,
long nbElems)
Update the B-tree number of elements
|
(package private) static <K,V> void |
setPage(BTree<K,V> btree,
Page<K,V> page,
int pos,
Page<K,V> child)
Set the page at a give position
|
(package private) static <K,V> void |
setPageSize(BTree<K,V> btree,
int pageSize)
Set the maximum number of elements we can store in a page.
|
(package private) static <K,V> void |
setRecordManager(BTree<K,V> btree,
RecordManager recordManager)
Set the RecordManager
|
(package private) static <K,V> void |
setRevision(BTree<K,V> btree,
long revision)
Update the B-tree revision
|
(package private) static <K,V> void |
setRootPage(BTree<K,V> btree,
Page<K,V> root)
Set the new root page for this tree.
|
(package private) static <K,V> void |
setRootPageOffset(BTree<K,V> btree,
long rootPageOffset)
Set the rootPage offset of the B-tree
|
(package private) static <K,V> void |
setValue(BTree<K,V> btree,
Page<K,V> page,
int pos,
ValueHolder<V> value)
Set the value at a give position
|
(package private) static <K,V> void |
setValueSerializer(BTree<K,V> btree,
java.lang.String valueSerializerFqcn)
Sets the ValueSerializer into the B-tree
|
public static <K,V> BTree<K,V> createPersistedBTree()
public static <K,V> BTree<K,V> createPersistedBTree(BTreeTypeEnum type)
public static <K,V> void setBtreeHeaderOffset(PersistedBTree<K,V> btree, long btreeHeaderOffset)
btree - The btree to updatebtreeHeaderOffset - The offsetpublic static <K,V> BTree<K,V> createPersistedBTree(PersistedBTreeConfiguration<K,V> configuration)
configuration - The configuration to usepublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, boolean allowDuplicates)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerallowDuplicates - Tells if the B-tree allows multiple value for a given keypublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, boolean allowDuplicates, int cacheSize)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerallowDuplicates - Tells if the B-tree allows multiple value for a given keycacheSize - The size to be used for this B-tree cachepublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pagepublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pageallowDuplicates - Tells if the B-tree allows multiple value for a given keypublic static <K,V> BTree<K,V> createPersistedBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates, int cacheSize)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pageallowDuplicates - Tells if the B-tree allows multiple value for a given keycacheSize - The size to be used for this B-tree cachepublic static <K,V> BTree<K,V> createInMemoryBTree()
public static <K,V> BTree<K,V> createInMemoryBTree(InMemoryBTreeConfiguration<K,V> configuration)
configuration - The configuration to usepublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, boolean allowDuplicates)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerallowDuplicates - Tells if the B-tree allows multiple value for a given keypublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize)
name - The B-tree's namekeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pagepublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, java.lang.String filePath, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer)
name - The B-tree's namefilePath - The name of the data directory with absolute pathkeySerializer - Key serializervalueSerializer - Value serializerpublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, java.lang.String filePath, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize)
name - The B-tree's namefilePath - The name of the data directory with absolute pathkeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pagepublic static <K,V> BTree<K,V> createInMemoryBTree(java.lang.String name, java.lang.String filePath, ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates)
name - The B-tree's namefilePath - The name of the data directory with absolute pathkeySerializer - Key serializervalueSerializer - Value serializerpageSize - Size of the pageallowDuplicates - Tells if the B-tree allows multiple value for a given keystatic <K,V> Page<K,V> createLeaf(BTree<K,V> btree, long revision, int nbElems)
btree - The B-tree which will contain this leafrevision - The Leaf's revisionnbElems - The number or elements in this leafstatic <K,V> Page<K,V> createNode(BTree<K,V> btree, long revision, int nbElems)
btree - The B-tree which will contain this noderevision - The Node's revisionnbElems - The number or elements in this nodestatic <K,V> void setKey(BTree<K,V> btree, Page<K,V> page, int pos, K key)
btree - The B-tree to updatepage - The page to updatepos - The position in the keys arraykey - The key to injectstatic <K,V> void setValue(BTree<K,V> btree, Page<K,V> page, int pos, ValueHolder<V> value)
btree - The B-tree to updatepage - The page to updatepos - The position in the values arrayvalue - the value to injectstatic <K,V> void setPage(BTree<K,V> btree, Page<K,V> page, int pos, Page<K,V> child)
btree - The B-tree to updatepage - The page to updatepos - The position in the values arraychild - the child page to injectstatic <K,V> void setKeySerializer(BTree<K,V> btree, java.lang.String keySerializerFqcn) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.IllegalArgumentException, java.lang.SecurityException, java.lang.NoSuchFieldException
btree - The B-tree to updatekeySerializerFqcn - the Key serializer FQCN to setjava.lang.ClassNotFoundException - If the key serializer class cannot be foundjava.lang.InstantiationException - If the key serializer class cannot be instanciatedjava.lang.IllegalAccessException - If the key serializer class cannot be accessedjava.lang.NoSuchFieldExceptionjava.lang.SecurityExceptionjava.lang.IllegalArgumentExceptionstatic <K,V> void setValueSerializer(BTree<K,V> btree, java.lang.String valueSerializerFqcn) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.IllegalArgumentException, java.lang.SecurityException, java.lang.NoSuchFieldException
btree - The B-tree to updatevalueSerializerFqcn - the Value serializer FQCN to setjava.lang.ClassNotFoundException - If the value serializer class cannot be foundjava.lang.InstantiationException - If the value serializer class cannot be instanciatedjava.lang.IllegalAccessException - If the value serializer class cannot be accessedjava.lang.NoSuchFieldExceptionjava.lang.SecurityExceptionjava.lang.IllegalArgumentExceptionstatic <K,V> void setRootPage(BTree<K,V> btree, Page<K,V> root)
btree - The B-tree to updateroot - the new root page.static <K,V> Page<K,V> getRootPage(BTree<K,V> btree)
btree - The B-tree we want to root page fromstatic <K,V> void setNbElems(BTree<K,V> btree, long nbElems)
btree - The B-tree to updatenbElems - the nbElems to setstatic <K,V> void setRevision(BTree<K,V> btree, long revision)
btree - The B-tree to updaterevision - the revision to setstatic <K,V> void setName(BTree<K,V> btree, java.lang.String name)
btree - The B-tree to updatename - the name to setstatic <K,V> void setPageSize(BTree<K,V> btree, int pageSize)
btree - The B-tree to updatepageSize - The requested page sizestatic <K,V> java.util.LinkedList<ParentPos<K,V>> getPathToRightMostLeaf(BTree<K,V> btree)
btree - the B-treestatic <K,V> void setRootPageOffset(BTree<K,V> btree, long rootPageOffset)
btree - The B-tree to updaterootPageOffset - The rootPageOffset to setstatic <K,V> void setRecordManager(BTree<K,V> btree, RecordManager recordManager)
btree - The B-tree to updaterecordManager - The injected RecordManagerstatic <K,V> void setKey(BTree<K,V> btree, Page<K,V> page, int pos, byte[] buffer)
btree - The B-tree to updatepage - The page to updatepos - The position of this key in the pagebuffer - The byte[] containing the serialized keystatic <K,V> java.util.LinkedList<ParentPos<K,V>> getPathToLeftMostLeaf(BTree<K,V> btree)
btree - The B-tree to process