org.egothor.repository
Interface DataRepository

All Known Implementing Classes:
Berkeley, BlobRepository, DocumentsDB, WebStore

public interface DataRepository

Interface of the data blocks repository.

Author:
Leo

Nested Class Summary
static interface DataRepository.TupleSequence
           
 
Method Summary
 int addItem(long key, byte[] document, int length)
          Adds another document into the repository.
 void close()
          Closes the repository.
 void destroy()
          Destroy the repository.
 DataInputStream elementAt(long key, int revision)
          Retrieves a data block.
 DataRepository.TupleSequence elements()
          The tuples are [long:uid;int:rev;Object:DataInputStream].
 void flush()
           
 

Method Detail

addItem

int addItem(long key,
            byte[] document,
            int length)
Adds another document into the repository. If the implementation is able to recognize whether the incoming data block is still the same (as the existing in the repository), it would discard the insertion request and return 0 as the signal of no-op.

Returns:
revision number (0 iff unchanged) or -1 when fails

elementAt

DataInputStream elementAt(long key,
                          int revision)
Retrieves a data block.

Parameters:
key - the key of the block
revision - revision number of the block, 0 is used for the latest (current) revision
Returns:
null if the revision is not available (or the key is unknown)

elements

DataRepository.TupleSequence elements()
The tuples are [long:uid;int:rev;Object:DataInputStream].


flush

void flush()

close

void close()
Closes the repository.


destroy

void destroy()
Destroy the repository.