public class MavibotTable<K,V> extends AbstractTable<K,V>
| Modifier and Type | Field and Description |
|---|---|
private ArrayMarshaller<V> |
arrayMarshaller
The marshaller that will be used to read the values when we have more than one
|
private org.apache.directory.mavibot.btree.BTree<K,V> |
bt
the underlying B-tree
|
private static org.slf4j.Logger |
LOG
A logger for this class
|
protected org.apache.directory.mavibot.btree.RecordManager |
recordMan
The used recordManager
|
allowsDuplicates, commitNumber, count, keyComparator, name, schemaManager, valueComparator| Constructor and Description |
|---|
MavibotTable(org.apache.directory.mavibot.btree.RecordManager recordMan,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
java.lang.String name,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<K> keySerializer,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<V> valueSerializer,
boolean allowDuplicates)
Creates a new instance of MavibotTable.
|
MavibotTable(org.apache.directory.mavibot.btree.RecordManager recordMan,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
java.lang.String name,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<K> keySerializer,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<V> valueSerializer,
boolean allowDuplicates,
int cacheSize)
Creates a new instance of MavibotTable.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying Db of this Table.
|
long |
count(K key)
Gets the count of the number of records in this Table with a specific
key: returns the number of duplicates for a key.
|
org.apache.directory.api.ldap.model.cursor.Cursor<org.apache.directory.api.ldap.model.cursor.Tuple<K,V>> |
cursor()
Creates a Cursor that traverses Tuples in a Table.
|
org.apache.directory.api.ldap.model.cursor.Cursor<org.apache.directory.api.ldap.model.cursor.Tuple<K,V>> |
cursor(K key)
Creates a Cursor that traverses Table Tuples for the same key.
|
V |
get(K key)
Gets the value of a record by key if the key exists.
|
protected org.apache.directory.mavibot.btree.BTree<K,V> |
getBTree() |
ArrayTree<V> |
getDupsContainer(byte[] serialized) |
long |
greaterThanCount(K key)
Gets the number of records greater than or equal to a key value.
|
boolean |
has(K key)
Checks to see if this table has one or more tuples with a specific key:
this is exactly the same as a get call with a check to see if the
returned value is null or not.
|
boolean |
has(K key,
V value)
Checks to see if this table has a key with a specific value.
|
boolean |
hasGreaterOrEqual(K key)
Checks to see if this table has a record with a key greater than or
equal to the key argument.
|
boolean |
hasGreaterOrEqual(K key,
V val)
Checks to see if this table has a Tuple with a key equal to the key
argument, yet with a value greater than or equal to the value argument
provided.
|
boolean |
hasLessOrEqual(K key)
Checks to see if this table has a record with a key less than or
equal to the key argument.
|
boolean |
hasLessOrEqual(K key,
V val)
Checks to see if this table has a Tuple with a key equal to the key
argument, yet with a value less than or equal to the value argument
provided.
|
boolean |
isDupsEnabled()
Checks to see if this Table has allows for duplicate keys (a.k.a.
|
long |
lessThanCount(K key)
Gets the number of records less than or equal to a key value.
|
void |
put(K key,
V value)
Puts a record into this Table.
|
void |
remove(K key)
Removes all records with a specified key from this Table.
|
void |
remove(K key,
V value)
Removes a single key value pair with a specified key and value from
this Table.
|
void |
sync()
Synchronizes the buffers with disk.
|
java.lang.String |
toString() |
org.apache.directory.api.ldap.model.cursor.Cursor<V> |
valueCursor(K key)
Creates a Cursor that traverses Table values for the same key.
|
count, getKeyComparator, getName, getValueComparatorprivate ArrayMarshaller<V> arrayMarshaller
private static final org.slf4j.Logger LOG
protected org.apache.directory.mavibot.btree.RecordManager recordMan
public MavibotTable(org.apache.directory.mavibot.btree.RecordManager recordMan,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
java.lang.String name,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<K> keySerializer,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<V> valueSerializer,
boolean allowDuplicates)
throws java.io.IOException
recordMan - The associated RecordManagerschemaManager - The SchemaManagername - The Table namekeySerializer - The Key serializervalueSerializer - The Value serializerallowDuplicates - If the table allows duplicate valuesjava.io.IOException - If the instance creation failedpublic MavibotTable(org.apache.directory.mavibot.btree.RecordManager recordMan,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
java.lang.String name,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<K> keySerializer,
org.apache.directory.mavibot.btree.serializer.ElementSerializer<V> valueSerializer,
boolean allowDuplicates,
int cacheSize)
throws java.io.IOException
recordMan - The associated RecordManagerschemaManager - The SchemaManagername - The Table namekeySerializer - The Key serializervalueSerializer - The Value serializerallowDuplicates - If the table allows duplicate valuescacheSize - The cache size to usejava.io.IOException - If the instance creation failedpublic boolean isDupsEnabled()
public boolean has(K key) throws org.apache.directory.api.ldap.model.exception.LdapException
key - the Object of the key to check fororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean has(K key, V value) throws org.apache.directory.api.ldap.model.exception.LdapException
key - the key to check forvalue - the value to check fororg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean hasGreaterOrEqual(K key) throws java.lang.Exception
key - the key to compare keys tojava.lang.Exception - if there is a failure to read the underlying Dbpublic boolean hasLessOrEqual(K key) throws java.lang.Exception
key - the key to compare keys tojava.lang.Exception - if there is a failure to read the underlying Dbpublic boolean hasGreaterOrEqual(K key, V val) throws org.apache.directory.api.ldap.model.exception.LdapException
key - the keyval - the value to compare values toorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean hasLessOrEqual(K key, V val) throws java.lang.Exception
key - the keyval - the value to compare values tojava.lang.Exception - if there is a failure to read the underlying Db
or if the underlying Db is not of the Btree type that allows sorted
duplicate values.public V get(K key) throws org.apache.directory.api.ldap.model.exception.LdapException
key - the key of the recordorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void put(K key, V value) throws java.lang.Exception
key - the key of the recordvalue - the value of the record.java.lang.Exception - if there is a failure to read or write to the
underlying Dbjava.lang.IllegalArgumentException - if a null key or value is usedpublic void remove(K key) throws java.lang.Exception
key - the key of the records to removejava.lang.Exception - if there is a failure to read or write to
the underlying Dbpublic void remove(K key, V value) throws java.lang.Exception
key - the key of the record to removevalue - the value of the record to removejava.lang.Exception - if there is a failure to read or write to
the underlying Dbpublic org.apache.directory.api.ldap.model.cursor.Cursor<org.apache.directory.api.ldap.model.cursor.Tuple<K,V>> cursor() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<org.apache.directory.api.ldap.model.cursor.Tuple<K,V>> cursor(K key) throws org.apache.directory.api.ldap.model.exception.LdapException
key - the duplicate key to return the Tuples oforg.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<V> valueCursor(K key) throws java.lang.Exception
key - the duplicate key to return the values ofjava.lang.Exception - if there are failures accessing underlying storespublic long count(K key) throws java.lang.Exception
key - the Object key to count.java.lang.Exception - if there is a failure to read the underlying Dbpublic long greaterThanCount(K key) throws java.lang.Exception
key - the key to use in comparisonsjava.lang.Exception - if there is a failure to read the underlying dbpublic long lessThanCount(K key) throws java.lang.Exception
key - the key to use in comparisonsjava.lang.Exception - if there is a failure to read the underlying dbpublic void close()
throws java.lang.Exception
java.lang.Exception - on any failurespublic ArrayTree<V> getDupsContainer(byte[] serialized) throws java.io.IOException
java.io.IOExceptionprotected org.apache.directory.mavibot.btree.BTree<K,V> getBTree()
public void sync()
throws java.io.IOException
java.io.IOException - if errors are encountered on the flushpublic java.lang.String toString()
toString in class AbstractTable<K,V>Object.toString()