|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.storage.dht.spi.cache.CacheChunkTable
public class CacheChunkTable
Cache wrapper around ChunkTable.
Constructor Summary | |
---|---|
CacheChunkTable(ChunkTable dbTable,
CacheDatabase cacheDatabase)
Initialize a new wrapper. |
Method Summary | |
---|---|
void |
get(Context options,
java.util.Set<ChunkKey> keys,
AsyncCallback<java.util.Collection<PackChunk.Members>> callback)
Asynchronously load one or more chunks |
void |
getMeta(Context options,
java.util.Set<ChunkKey> keys,
AsyncCallback<java.util.Map<ChunkKey,GitStore.ChunkMeta>> callback)
Asynchronously load one or more chunk meta fields. |
void |
put(PackChunk.Members chunk,
WriteBuffer buffer)
Put some (or all) of a single chunk. |
void |
remove(ChunkKey key,
WriteBuffer buffer)
Completely remove a chunk and all of its data elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CacheChunkTable(ChunkTable dbTable, CacheDatabase cacheDatabase)
dbTable
- the underlying database's corresponding table.cacheDatabase
- the cache database.Method Detail |
---|
public void get(Context options, java.util.Set<ChunkKey> keys, AsyncCallback<java.util.Collection<PackChunk.Members>> callback)
ChunkTable
Callers are responsible for breaking up very large collections of chunk keys into smaller units, based on the reader's batch size option. Since chunks typically 1 MB each, 10-20 keys is a reasonable batch size, but depends on available JVM memory and performance of this method obtaining chunks from the database.
get
in interface ChunkTable
options
- options to control reading.keys
- the chunk keys to obtain.callback
- receives the results when ready. If this is an instance of
StreamingCallback
, implementors should try to deliver
results early.public void getMeta(Context options, java.util.Set<ChunkKey> keys, AsyncCallback<java.util.Map<ChunkKey,GitStore.ChunkMeta>> callback)
ChunkTable
Usually meta is loaded by ChunkTable.get(Context, Set, AsyncCallback)
, but
some uses may require looking up the fragment data without having the
entire chunk.
getMeta
in interface ChunkTable
options
- options to control reading.keys
- the chunk keys to obtain.callback
- receives the results when ready. If this is an instance of
StreamingCallback
, implementors should try to deliver
results early.public void put(PackChunk.Members chunk, WriteBuffer buffer) throws DhtException
ChunkTable
The higher level storage layer typically stores chunks in pieces. Its common to first store the data, then much later store the fragments and index. Sometimes all of the members are ready at once, and can be put together as a single unit. This method handles both approaches to storing a chunk.
Implementors must use a partial writing approach, for example:
ColumnUpdateList list = ...; if (chunk.getChunkData() != null) list.addColumn("chunk_data", chunk.getChunkData()); if (chunk.getChunkIndex() != null) list.addColumn("chunk_index", chunk.getChunkIndex()); if (chunk.getFragments() != null) list.addColumn("fragments", chunk.getFragments()); createOrUpdateRow(chunk.getChunkKey(), list);
put
in interface ChunkTable
chunk
- description of the chunk to be stored.buffer
- buffer to enqueue the put onto.
DhtException
- if the buffer flushed and an enqueued operation failed.public void remove(ChunkKey key, WriteBuffer buffer) throws DhtException
ChunkTable
Chunk removal should occur as quickly as possible after the flush has completed, as the caller has already ensured the chunk is not in use.
remove
in interface ChunkTable
key
- key of the chunk to remove.buffer
- buffer to enqueue the remove onto.
DhtException
- if the buffer flushed and an enqueued operation failed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |