net.obsearch.storage
Interface OBStoreDouble

All Superinterfaces:
OBStore<TupleDouble>
All Known Implementing Classes:
BDBOBStoreJeDouble

public interface OBStoreDouble
extends OBStore<TupleDouble>

OBStoreDouble 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 double.

Author:
Arnoldo Jose Muller Molina

Method Summary
 double bytesToValue(byte[] entry)
          Convert a byte entry into a double.
 OperationStatus delete(double key)
          Deletes the given key and its corresponding value from the database.
 byte[] getValue(double key)
          Returns the associated value for the given key.
 CloseIterator<TupleDouble> processRange(double low, double high)
          Process the given range of items (from low to high), including low and high.
 CloseIterator<TupleDouble> processRangeReverse(double low, double high)
          Process the given range of items (from high to low), including low and high.
 OperationStatus put(double 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(double 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<TupleDouble> processRange(double low,
                                        double 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<TupleDouble> processRangeReverse(double low,
                                               double 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(double 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(double 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

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



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