|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.obsearch.storage.bdb.AbstractBDBOBStoreJe<T>
public abstract class AbstractBDBOBStoreJe<T extends Tuple>
BDBOBStore is a storage abstraction for Berkeley DB. It is designed to work on byte array keys storing byte array values.
Nested Class Summary | |
---|---|
protected class |
AbstractBDBOBStoreJe.ByteArrayIterator
Iterator used to process range results. |
protected class |
AbstractBDBOBStoreJe.CursorIterator<T>
Base class used to iterate over cursors. |
Field Summary | |
---|---|
protected com.sleepycat.je.Sequence |
counter
Sequence counter |
protected com.sleepycat.je.Database |
db
Berkeley DB database. |
protected com.sleepycat.je.Database |
sequence
Database for sequences. |
protected hep.aida.bin.StaticBin1D |
stats
|
Constructor Summary | |
---|---|
AbstractBDBOBStoreJe(String name,
com.sleepycat.je.Database db,
com.sleepycat.je.Database sequences,
OBStoreFactory fact,
boolean duplicates)
Builds a new Storage system by receiving a Berkeley DB database. |
Method Summary | |
---|---|
boolean |
allowsDuplicatedData()
|
void |
close()
Closes the storage system. |
OperationStatus |
delete(byte[] key)
Deletes the given key and its corresponding value from the database. |
void |
deleteAll()
Deletes all the items in the storage system. |
OBStoreFactory |
getFactory()
Return the factory associated to this storage device. |
String |
getName()
Get the name of this storage system. |
hep.aida.bin.StaticBin1D |
getReadStats()
Returns the read stats, it contains the avg # of bytes read the std deviation and also the number of reads. |
Object |
getStats()
Return the stats of this object (to be printed for the user) |
byte[] |
getValue(byte[] key)
Returns the associated value for the given key. |
long |
nextId()
Returns the next id from the database (incrementing sequences). |
void |
optimize()
Somehow optimizes the underlying storage representation. |
byte[] |
prepareBytes(byte[] in)
Transform Bytes in a format that can be used by the underlying index. |
CloseIterator<byte[]> |
processAllKeys()
Transform Bytes in a format that can be used by the underlying index. |
CloseIterator<TupleBytes> |
processRange(byte[] low,
byte[] high)
Process the given range of items (from low to high), including low and high. |
CloseIterator<TupleBytes> |
processRangeNoDup(byte[] low,
byte[] high)
Process the given range of items (from low to high), including low and high. |
CloseIterator<TupleBytes> |
processRangeReverse(byte[] low,
byte[] high)
Process the given range of items (from high to low), including low and high. |
CloseIterator<TupleBytes> |
processRangeReverseNoDup(byte[] low,
byte[] high)
Process the given range of items (from high to low), including low and high. |
OperationStatus |
put(byte[] key,
byte[] value)
Inserts the key value pair. |
OperationStatus |
putIfNew(byte[] key,
byte[] value)
|
void |
setReadStats(hep.aida.bin.StaticBin1D stats)
Sets the stats object to the given stats. |
long |
size()
Returns the number of elements in the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.obsearch.storage.OBStore |
---|
processAll |
Field Detail |
---|
protected hep.aida.bin.StaticBin1D stats
protected com.sleepycat.je.Database db
protected com.sleepycat.je.Database sequence
protected com.sleepycat.je.Sequence counter
Constructor Detail |
---|
public AbstractBDBOBStoreJe(String name, com.sleepycat.je.Database db, com.sleepycat.je.Database sequences, OBStoreFactory fact, boolean duplicates) throws com.sleepycat.je.DatabaseException
db
- The database to be stored.name
- Name of the database.sequences
- Database used to store sequences.
com.sleepycat.je.DatabaseException
- if something goes wrong with the database.Method Detail |
---|
public OBStoreFactory getFactory()
OBStore
getFactory
in interface OBStore<T extends Tuple>
public void close() throws OBStorageException
OBStore
close
in interface OBStore<T extends Tuple>
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public OperationStatus delete(byte[] key) throws OBStorageException
OBStore
delete
in interface OBStore<T extends Tuple>
key
- The key that will be deleted.
Status.OK
if the key was found, otherwise,
Status.NOT_EXISTS
.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public void deleteAll() throws OBStorageException
OBStore
deleteAll
in interface OBStore<T extends Tuple>
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public String getName()
OBStore
getName
in interface OBStore<T extends Tuple>
public byte[] getValue(byte[] key) throws IllegalArgumentException, OBStorageException
OBStore
getValue
in interface OBStore<T extends Tuple>
key
- The key that will be searched.
IllegalArgumentException
- If the underlying storage system can hold multiple keys (
#allowsDuplicatedData()
== true).
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public OperationStatus put(byte[] key, byte[] value) throws OBStorageException
OBStore
put
in interface OBStore<T extends Tuple>
key
- Key to insertvalue
- The value that the key will hold after this operation
completes.
Status.OK
the record was inserted/updated
successfully. Status.ERROR
if the record
could not be updated.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public OperationStatus putIfNew(byte[] key, byte[] value) throws OBStorageException
OBStorageException
public boolean allowsDuplicatedData()
public CloseIterator<byte[]> processAllKeys() throws OBStorageException
in
- Input byte array
OBStorageException
public byte[] prepareBytes(byte[] in)
OBStore
prepareBytes
in interface OBStore<T extends Tuple>
in
- Input byte array
public CloseIterator<TupleBytes> processRange(byte[] low, byte[] high) throws OBStorageException
OBStore
processRange
in interface OBStore<T extends Tuple>
low
- lowest key value to return.high
- highest key value to return.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public CloseIterator<TupleBytes> processRangeNoDup(byte[] low, byte[] high) throws OBStorageException
OBStore
processRangeNoDup
in interface OBStore<T extends Tuple>
low
- lowest key value to return.high
- highest key value to return.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public CloseIterator<TupleBytes> processRangeReverse(byte[] low, byte[] high) throws OBStorageException
OBStore
processRangeReverse
in interface OBStore<T extends Tuple>
low
- lowest key value to return.high
- highest key value to return.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public CloseIterator<TupleBytes> processRangeReverseNoDup(byte[] low, byte[] high) throws OBStorageException
OBStore
processRangeReverseNoDup
in interface OBStore<T extends Tuple>
low
- lowest key value to return.high
- highest key value to return.
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public long size() throws OBStorageException
OBStore
size
in interface OBStore<T extends Tuple>
OBStorageException
- If an exception occurs at the underlying storage system. You
can query the exception to see more details regarding the
nature of the error.public void optimize()
OBStore
optimize
in interface OBStore<T extends Tuple>
public long nextId() throws OBStorageException
nextId
in interface OBStore<T extends Tuple>
OBStorageException
public hep.aida.bin.StaticBin1D getReadStats()
OBStore
getReadStats
in interface OBStore<T extends Tuple>
public void setReadStats(hep.aida.bin.StaticBin1D stats)
OBStore
setReadStats
in interface OBStore<T extends Tuple>
public Object getStats()
OBStore
getStats
in interface OBStore<T extends Tuple>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |