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

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

public class CacheRefTable
extends java.lang.Object
implements RefTable

Cache wrapper around RefTable.

Currently this is a straight pass-through.


Constructor Summary
CacheRefTable(RefTable dbTable, CacheDatabase cacheDatabase)
          Initialize a new wrapper.
 
Method Summary
 boolean compareAndPut(RefKey refKey, GitStore.RefData oldData, GitStore.RefData newData)
          Compare a reference, and put if it matches.
 boolean compareAndRemove(RefKey refKey, GitStore.RefData oldData)
          Compare a reference, and delete if it matches.
 java.util.Map<RefKey,GitStore.RefData> getAll(Context options, RepositoryKey repository)
          Read all known references in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheRefTable

public CacheRefTable(RefTable dbTable,
                     CacheDatabase cacheDatabase)
Initialize a new wrapper.

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

getAll

public java.util.Map<RefKey,GitStore.RefData> getAll(Context options,
                                                     RepositoryKey repository)
                                              throws DhtException,
                                                     java.util.concurrent.TimeoutException
Description copied from interface: RefTable
Read all known references in the repository.

Specified by:
getAll in interface RefTable
Parameters:
options - options to control reading.
repository - the repository to load the references from.
Returns:
map of all references. Empty map if there are no references.
Throws:
DhtException - the database cannot be read.
java.util.concurrent.TimeoutException - the operation to read the database timed out.

compareAndRemove

public boolean compareAndRemove(RefKey refKey,
                                GitStore.RefData oldData)
                         throws DhtException,
                                java.util.concurrent.TimeoutException
Description copied from interface: RefTable
Compare a reference, and delete if it matches.

Specified by:
compareAndRemove in interface RefTable
Parameters:
refKey - reference to delete.
oldData - the old data for the reference. The delete only occurs if the value is still equal to oldData.
Returns:
true if the delete was successful; false if the current value does not match oldData.
Throws:
DhtException - the database cannot be updated.
java.util.concurrent.TimeoutException - the operation to modify the database timed out.

compareAndPut

public boolean compareAndPut(RefKey refKey,
                             GitStore.RefData oldData,
                             GitStore.RefData newData)
                      throws DhtException,
                             java.util.concurrent.TimeoutException
Description copied from interface: RefTable
Compare a reference, and put if it matches.

Specified by:
compareAndPut in interface RefTable
Parameters:
refKey - reference to create or replace.
oldData - the old data for the reference. The put only occurs if the value is still equal to oldData. Use RefDataUtil.NONE if the reference should not exist and is being created.
newData - new value to store.
Returns:
true if the put was successful; false if the current value does not match prior.
Throws:
DhtException - the database cannot be updated.
java.util.concurrent.TimeoutException - the operation to modify the database timed out.


Copyright © 2011. All Rights Reserved.