public class BTreeIndexFactory<Key,Value> extends Object implements IndexFactory<Key,Value>
Constructor and Description |
---|
BTreeIndexFactory() |
Modifier and Type | Method and Description |
---|---|
SortedIndex<Key,Value> |
create(Paged paged)
Creates a new BTree index on the Paged object.
|
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.
|
SortedIndex<Key,Value> |
openOrCreate(Paged paged) |
void |
setComparator(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.
|
String |
toString() |
public SortedIndex<Key,Value> create(Paged paged)
create
in interface IndexFactory<Key,Value>
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 SortedIndex<Key,Value> openOrCreate(Paged paged)
openOrCreate
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 Comparator getComparator()
public void setComparator(Comparator comparator)
Comparable
interface.comparator
- Copyright © 2009–2016 FuseSource, Corp.. All rights reserved.