|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
A distributed database implementation.
A DHT provider must implement this interface to return table references for each of the named tables. The database and the tables it returns are held as singletons, and thus must be thread-safe. If the underlying implementation needs to use individual "connections" for each operation, it is responsible for setting up a connection pool, borrowing and returning resources within each of the table APIs.
Most APIs on the tables are asynchronous and must perform their computation
in the background using a different thread than the caller. Implementations
that have only an underlying synchronous API should configure and use an
ExecutorService
to perform computation in the
background on a thread pool.
Tables returned by these methods should be singletons, as the higher level DHT implementation usually invokes these methods each time it needs to use a given table. The suggested implementation approach is:
class MyDatabase implements Database { private final RepositoryIndexTable rep = new MyRepositoryIndex(); private final RefTable ref = new MyRefTable(); public RepositoryIndexTable repositoryIndex() { return rep; } public RefTable ref() { return ref; } }
Method Summary | |
---|---|
ChunkTable |
chunk()
|
WriteBuffer |
newWriteBuffer()
Create a new WriteBuffer for the current thread. |
ObjectIndexTable |
objectIndex()
|
RefTable |
ref()
|
RepositoryTable |
repository()
|
RepositoryIndexTable |
repositoryIndex()
|
Method Detail |
---|
RepositoryIndexTable repositoryIndex()
RepositoryTable repository()
RefTable ref()
ObjectIndexTable objectIndex()
ChunkTable chunk()
WriteBuffer newWriteBuffer()
Unlike other methods on this interface, the returned buffer must be a new object on every invocation. Buffers do not need to be thread-safe.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |