|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable<K,V>
public class JdbmTable<K,V>
A jdbm Btree wrapper that enables duplicate sorted keys using collections.
Constructor Summary | |
---|---|
JdbmTable(java.lang.String name,
int numDupLimit,
RecordManager manager,
java.util.Comparator<K> keyComparator,
java.util.Comparator<V> valueComparator,
Serializer keySerializer,
Serializer valueSerializer)
Creates a Jdbm BTree based tuple Table abstraction that enables duplicates. |
|
JdbmTable(java.lang.String name,
RecordManager manager,
SerializableComparator<K> keyComparator,
Serializer keySerializer,
Serializer valueSerializer)
Creates a Jdbm BTree based tuple Table abstraction without duplicates enabled using a simple key comparator. |
Method Summary | |
---|---|
void |
close()
Closes the underlying Db of this Table. |
int |
count()
Gets the count of the number of records in this Table. |
int |
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. |
Cursor<Tuple<K,V>> |
cursor()
Creates a Cursor that traverses Tuples in a Table. |
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. |
java.util.Comparator<K> |
getKeyComparator()
Gets the key comparator used by this Table: may be null if this Table was not initialized with one. |
Serializer |
getKeySerializer()
|
Marshaller<AvlTree<V>> |
getMarshaller()
|
java.lang.String |
getName()
Gets the name of this Table. |
java.util.Comparator<V> |
getValueComparator()
Gets the value comparator used by this Table: may be null if this Table was not initialized with one. |
Serializer |
getValueSerializer()
|
int |
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 |
isCountExact()
Checks whether or not calls to count the number of keys greater than or less than the key are exact. |
boolean |
isDupsEnabled()
Checks to see if this Table has allows for duplicate keys (a.k.a. |
int |
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. |
Cursor<V> |
valueCursor(K key)
Creates a Cursor that traverses Table values for the same key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JdbmTable(java.lang.String name, int numDupLimit, RecordManager manager, java.util.Comparator<K> keyComparator, java.util.Comparator<V> valueComparator, Serializer keySerializer, Serializer valueSerializer) throws java.io.IOException
name
- the name of the tablenumDupLimit
- the size limit of duplicates before switching to
BTrees for values instead of AvlTreesmanager
- the record manager to be used for this tablekeyComparator
- a key comparatorvalueComparator
- a value comparatorkeySerializer
- a serializer to use for the keys instead of using
default Java serialization which could be very expensivevalueSerializer
- a serializer to use for the values instead of
using default Java serialization which could be very expensive
java.io.IOException
- if the table's file cannot be createdpublic JdbmTable(java.lang.String name, RecordManager manager, SerializableComparator<K> keyComparator, Serializer keySerializer, Serializer valueSerializer) throws java.io.IOException
name
- the name of the tablemanager
- the record manager to be used for this tablekeyComparator
- a tuple comparatorkeySerializer
- a serializer to use for the keys instead of using
default Java serialization which could be very expensivevalueSerializer
- a serializer to use for the values instead of
using default Java serialization which could be very expensive
java.io.IOException
- if the table's file cannot be createdMethod Detail |
---|
public java.util.Comparator<K> getKeyComparator()
Table
getKeyComparator
in interface Table<K,V>
Table.getKeyComparator()
public java.util.Comparator<V> getValueComparator()
Table
getValueComparator
in interface Table<K,V>
Table.getValueComparator()
public Serializer getKeySerializer()
public Serializer getValueSerializer()
public boolean isDupsEnabled()
Table
isDupsEnabled
in interface Table<K,V>
Table.isDupsEnabled()
public java.lang.String getName()
Table
getName
in interface Table<K,V>
Table.getName()
public boolean isCountExact()
Table
isCountExact
in interface Table<K,V>
public int greaterThanCount(K key) throws java.io.IOException
Table
greaterThanCount
in interface Table<K,V>
key
- the key to use in comparisons
java.io.IOException
Table.greaterThanCount(Object)
public int lessThanCount(K key) throws java.io.IOException
Table
lessThanCount
in interface Table<K,V>
key
- the key to use in comparisons
java.io.IOException
Table.lessThanCount(Object)
public int count(K key) throws java.io.IOException
Table
count
in interface Table<K,V>
key
- the Object key to count.
java.io.IOException
Table.count(java.lang.Object)
public int count() throws java.io.IOException
Table
count
in interface Table<K,V>
java.io.IOException
Table.count()
public V get(K key) throws java.lang.Exception
Table
get
in interface Table<K,V>
key
- the key of the record
java.lang.Exception
- if there is a failure to read the underlying Dbpublic boolean hasGreaterOrEqual(K key, V val) throws java.io.IOException
Table
hasGreaterOrEqual
in interface Table<K,V>
key
- the keyval
- the value to compare values to
java.io.IOException
Table.hasGreaterOrEqual(Object,Object)
public boolean hasLessOrEqual(K key, V val) throws java.io.IOException
Table
hasLessOrEqual
in interface Table<K,V>
key
- the keyval
- the value to compare values to
java.io.IOException
Table.hasLessOrEqual(Object,Object)
public boolean hasGreaterOrEqual(K key) throws java.io.IOException
Table
hasGreaterOrEqual
in interface Table<K,V>
key
- the key to compare keys to
java.io.IOException
Table.hasGreaterOrEqual(Object)
public boolean hasLessOrEqual(K key) throws java.io.IOException
Table
hasLessOrEqual
in interface Table<K,V>
key
- the key to compare keys to
java.io.IOException
Table.hasLessOrEqual(Object)
public boolean has(K key, V value) throws java.io.IOException
Table
has
in interface Table<K,V>
key
- the key to check forvalue
- the value to check for
java.io.IOException
Table.has(java.lang.Object,
java.lang.Object)
public boolean has(K key) throws java.io.IOException
Table
has
in interface Table<K,V>
key
- the Object of the key to check for
java.io.IOException
Table.has(java.lang.Object)
public void put(K key, V value) throws java.lang.Exception
Table
put
in interface Table<K,V>
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 Db
java.lang.IllegalArgumentException
- if a null key or value is usedTable.put(java.lang.Object,
java.lang.Object)
public void remove(K key, V value) throws java.io.IOException
Table
remove
in interface Table<K,V>
key
- the key of the record to removevalue
- the value of the record to remove
java.io.IOException
Table.remove(java.lang.Object,
java.lang.Object)
public void remove(K key) throws java.io.IOException
Table
remove
in interface Table<K,V>
key
- the key of the records to remove
java.io.IOException
Table.remove(Object)
public Cursor<Tuple<K,V>> cursor() throws java.lang.Exception
Table
cursor
in interface Table<K,V>
java.lang.Exception
- if there are failures accessing underlying storespublic Cursor<Tuple<K,V>> cursor(K key) throws java.lang.Exception
Table
cursor
in interface Table<K,V>
key
- the duplicate key to return the Tuples of
java.lang.Exception
- if there are failures accessing underlying storespublic Cursor<V> valueCursor(K key) throws java.lang.Exception
Table
valueCursor
in interface Table<K,V>
key
- the duplicate key to return the values of
java.lang.Exception
- if there are failures accessing underlying storespublic void close() throws java.io.IOException
Table
close
in interface Table<K,V>
java.io.IOException
Table.close()
public void sync() throws java.io.IOException
java.io.IOException
- if errors are encountered on the flushpublic Marshaller<AvlTree<V>> getMarshaller()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |