org.eclipse.jgit.storage.dht.spi.cache
Class CacheRepositoryTable

java.lang.Object
  extended by org.eclipse.jgit.storage.dht.spi.cache.CacheRepositoryTable
All Implemented Interfaces:
RepositoryTable

public class CacheRepositoryTable
extends java.lang.Object
implements RepositoryTable

Cache wrapper around RepositoryTable.


Constructor Summary
CacheRepositoryTable(RepositoryTable dbTable, CacheDatabase cacheDatabase)
          Initialize a new wrapper.
 
Method Summary
 java.util.Collection<GitStore.CachedPackInfo> getCachedPacks(RepositoryKey repo)
          Get the cached packs, if any.
 RepositoryKey nextKey()
          Generate a new unique RepositoryKey.
 void put(RepositoryKey repo, ChunkInfo info, WriteBuffer buffer)
          Record the existence of a chunk.
 void put(RepositoryKey repo, GitStore.CachedPackInfo info, WriteBuffer buffer)
          Record the existence of a cached pack.
 void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer)
          Remove the existence of a cached pack.
 void remove(RepositoryKey repo, ChunkKey chunk, WriteBuffer buffer)
          Remove the information about a chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheRepositoryTable

public CacheRepositoryTable(RepositoryTable dbTable,
                            CacheDatabase cacheDatabase)
Initialize a new wrapper.

Parameters:
dbTable - the underlying database's corresponding table.
cacheDatabase - the cache database.
Method Detail

nextKey

public RepositoryKey nextKey()
                      throws DhtException
Description copied from interface: RepositoryTable
Generate a new unique RepositoryKey.

Specified by:
nextKey in interface RepositoryTable
Returns:
a new unique key.
Throws:
DhtException - keys cannot be generated at this time.

put

public void put(RepositoryKey repo,
                ChunkInfo info,
                WriteBuffer buffer)
         throws DhtException
Description copied from interface: RepositoryTable
Record the existence of a chunk.

Specified by:
put in interface RepositoryTable
Parameters:
repo - repository owning the chunk.
info - information about the chunk.
buffer - buffer to enqueue the put onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.

remove

public void remove(RepositoryKey repo,
                   ChunkKey chunk,
                   WriteBuffer buffer)
            throws DhtException
Description copied from interface: RepositoryTable
Remove the information about a chunk.

Specified by:
remove in interface RepositoryTable
Parameters:
repo - repository owning the chunk.
chunk - the chunk that needs to be deleted.
buffer - buffer to enqueue the remove onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.

getCachedPacks

public java.util.Collection<GitStore.CachedPackInfo> getCachedPacks(RepositoryKey repo)
                                                             throws DhtException,
                                                                    java.util.concurrent.TimeoutException
Description copied from interface: RepositoryTable
Get the cached packs, if any.

Specified by:
getCachedPacks in interface RepositoryTable
Parameters:
repo - repository owning the packs.
Returns:
cached pack descriptions.
Throws:
DhtException
java.util.concurrent.TimeoutException

put

public void put(RepositoryKey repo,
                GitStore.CachedPackInfo info,
                WriteBuffer buffer)
         throws DhtException
Description copied from interface: RepositoryTable
Record the existence of a cached pack.

Specified by:
put in interface RepositoryTable
Parameters:
repo - repository owning the pack.
info - information about the pack.
buffer - buffer to enqueue the put onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.

remove

public void remove(RepositoryKey repo,
                   CachedPackKey key,
                   WriteBuffer buffer)
            throws DhtException
Description copied from interface: RepositoryTable
Remove the existence of a cached pack.

Specified by:
remove in interface RepositoryTable
Parameters:
repo - repository owning the pack.
key - information about the pack.
buffer - buffer to enqueue the put onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.


Copyright © 2011. All Rights Reserved.