net.obsearch.storage
Interface OBStoreShort

All Superinterfaces:
OBStore<TupleShort>
All Known Implementing Classes:
BDBOBStoreJeShort

public interface OBStoreShort
extends OBStore<TupleShort>

OBStoreShort abstracts a generic storage system. The purpose of this class is to allow OBSearch to run on top of different storage systems (distributed, local, file system based, etc). The keys can be sorted, and range queries are possible. This interface provides utility methods for keys of type short.

Author:
Arnoldo Jose Muller Molina

Method Summary
 short bytesToValue(byte[] entry)
          Convert a byte entry into a short.
 OperationStatus delete(short key)
          Deletes the given key and its corresponding value from the database.
 byte[] getValue(short key)
          Returns the associated value for the given key.
 CloseIterator<TupleShort> processRange(short low, short high)
          Process the given range of items (from low to high), including low and high.
 CloseIterator<TupleShort> processRangeReverse(short low, short high)
          Process the given range of items (from high to low), including low and high.
 OperationStatus put(short key, byte[] value)
          Inserts the key value pair.
 
Methods inherited from interface net.obsearch.storage.OBStore
close, delete, deleteAll, getFactory, getName, getReadStats, getStats, getValue, nextId, optimize, prepareBytes, processAll, processRange, processRangeNoDup, processRangeReverse, processRangeReverseNoDup, put, setReadStats, size
 

Method Detail

getValue

byte[] getValue(short key)
                throws IllegalArgumentException,
                       OBStorageException
Returns the associated value for the given key. If the underlying storage system can hold repeated keys, then an IllegalArgumentException is thrown.

Parameters:
key - the key that will be searched.
Returns:
the associated value for the given key.
Throws:
IllegalArgumentException - If the underlying storage system can hold multiple keys.
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.

processRange

CloseIterator<TupleShort> processRange(short low,
                                       short high)
                                       throws OBStorageException
Process the given range of items (from low to high), including low and high. The TupleProcessor's process method will be called for each value found within the range.

Parameters:
low -
high -
Throws:
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.

processRangeReverse

CloseIterator<TupleShort> processRangeReverse(short low,
                                              short high)
                                              throws OBStorageException
Process the given range of items (from high to low), including low and high. The TupleProcessor's process method will be called for each value found within the range.

Parameters:
low -
high -
Throws:
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.

put

OperationStatus put(short key,
                    byte[] value)
                    throws OBStorageException
Inserts the key value pair. If the key existed, it will be overwritten.

Parameters:
key - Key to insert
value - The value that the key will hold after this operation completes.
Returns:
net.obsearch.OperationStatus.Status#OK the record was inserted/updated successfully. net.obsearch.OperationStatus.Status#ERROR if the record could not be updated.
Throws:
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.

delete

OperationStatus delete(short key)
                       throws OBStorageException
Deletes the given key and its corresponding value from the database.

Parameters:
key - The key that will be deleted.
Returns:
net.obsearch.OperationStatus.Status#OK if the key was found, otherwise, net.obsearch.OperationStatus.Status#NOT_EXISTS.
Throws:
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.

bytesToValue

short bytesToValue(byte[] entry)
Convert a byte entry into a short.



Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.