|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fusesource.hawtdb.api.BTreeIndexFactory<Key,Value>
public class BTreeIndexFactory<Key,Value>
This object is used to create variable magnitude b+tree indexes.
A b+tree can be used for set or map-based indexing. Leaf
nodes are linked together for faster iteration of the values.
The variable magnitude attribute means that the b+tree attempts
to store as many values and pointers on one page as is possible.
It will act as a simple-prefix b+tree if a prefixer is configured.
In a simple-prefix b+tree, instead of promoting actual keys to branch pages, when
leaves are split, a shortest-possible separator is generated at the pivot.
That separator is what is promoted to the parent branch (and continuing up
the list). As a result, actual keys and pointers can only be found at the
leaf level. This also affords the index the ability to ignore costly merging
and redistribution of pages when deletions occur. Deletions only affect leaf
pages in this implementation, and so it is entirely possible for a leaf page
to be completely empty after all of its keys have been removed.
Constructor Summary | |
---|---|
BTreeIndexFactory()
|
Method Summary | |
---|---|
SortedIndex<Key,Value> |
create(Paged paged)
Creates a new BTree index on the Paged object. |
java.util.Comparator |
getComparator()
Gets the custom configured Comparator used to sort the keys in the index. |
org.fusesource.hawtbuf.codec.Codec<Key> |
getKeyCodec()
Defaults to an ObjectCodec if not explicitly set. |
Prefixer<Key> |
getPrefixer()
|
org.fusesource.hawtbuf.codec.Codec<Value> |
getValueCodec()
Defaults to an ObjectCodec if not explicitly set. |
boolean |
isDeferredEncoding()
|
SortedIndex<Key,Value> |
open(Paged paged)
Loads an existing BTree index from the paged object. |
SortedIndex<Key,Value> |
open(Paged paged,
int indexNumber)
Loads an existing BTree index from the paged object. |
void |
setComparator(java.util.Comparator comparator)
Configures a custom Comparator used to sort the keys in the index. |
void |
setDeferredEncoding(boolean enable)
When deferred encoding is enabled, the index avoids encoding keys and values for as long as possible so take advantage of collapsing multiple updates of the same key/value into a single update operation and single encoding operation. |
void |
setKeyCodec(org.fusesource.hawtbuf.codec.Codec<Key> codec)
Allows you to configure custom marshalling logic to encode the index keys. |
void |
setPrefixer(Prefixer<Key> prefixer)
|
void |
setValueCodec(org.fusesource.hawtbuf.codec.Codec<Value> codec)
Allows you to configure custom marshalling logic to encode the index values. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BTreeIndexFactory()
Method Detail |
---|
public SortedIndex<Key,Value> create(Paged paged)
create
in interface IndexFactory<Key,Value>
public java.lang.String toString()
toString
in class java.lang.Object
public SortedIndex<Key,Value> open(Paged paged, int indexNumber)
open
in interface IndexFactory<Key,Value>
public SortedIndex<Key,Value> open(Paged paged)
open
in interface IndexFactory<Key,Value>
public org.fusesource.hawtbuf.codec.Codec<Key> getKeyCodec()
ObjectCodec
if not explicitly set.
public void setKeyCodec(org.fusesource.hawtbuf.codec.Codec<Key> codec)
codec
- the marshaller used for keys.public org.fusesource.hawtbuf.codec.Codec<Value> getValueCodec()
ObjectCodec
if not explicitly set.
public void setValueCodec(org.fusesource.hawtbuf.codec.Codec<Value> codec)
codec
- the marshaller used for valuespublic boolean isDeferredEncoding()
public void setDeferredEncoding(boolean enable)
When deferred encoding is enabled, the index avoids encoding keys and values for as long as possible so take advantage of collapsing multiple updates of the same key/value into a single update operation and single encoding operation.
Using this feature requires the keys and values to be immutable objects since unexpected errors would occur if they are changed after they have been handed to to the index for storage.
enable
- should deferred encoding be enabled.public Prefixer<Key> getPrefixer()
public void setPrefixer(Prefixer<Key> prefixer)
public java.util.Comparator getComparator()
public void setComparator(java.util.Comparator comparator)
Comparable
interface.
comparator
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |