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

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

public class CacheRepositoryIndexTable
extends java.lang.Object
implements RepositoryIndexTable

Cache wrapper around RepositoryIndexTable.


Constructor Summary
CacheRepositoryIndexTable(RepositoryIndexTable dbTable, CacheDatabase cacheDatabase)
          Initialize a new wrapper.
 
Method Summary
 RepositoryKey get(RepositoryName name)
          Find a repository by name.
 void putUnique(RepositoryName name, RepositoryKey key)
          Atomically record the association of name to identifier.
 void remove(RepositoryName name, RepositoryKey key)
          Remove the association of a name to an identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheRepositoryIndexTable

public CacheRepositoryIndexTable(RepositoryIndexTable dbTable,
                                 CacheDatabase cacheDatabase)
Initialize a new wrapper.

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

get

public RepositoryKey get(RepositoryName name)
                  throws DhtException,
                         java.util.concurrent.TimeoutException
Description copied from interface: RepositoryIndexTable
Find a repository by name.

Specified by:
get in interface RepositoryIndexTable
Parameters:
name - name of the repository, from the URL.
Returns:
the internal key; null if not found.
Throws:
DhtException
java.util.concurrent.TimeoutException

putUnique

public void putUnique(RepositoryName name,
                      RepositoryKey key)
               throws DhtException,
                      java.util.concurrent.TimeoutException
Description copied from interface: RepositoryIndexTable
Atomically record the association of name to identifier.

This method must use some sort of transaction system to ensure the name either points at key when complete, or fails fast with an exception if the name is used by a different key. This may require running some sort of lock management service in parallel to the database.

Specified by:
putUnique in interface RepositoryIndexTable
Parameters:
name - name of the repository.
key - internal key used to find the repository's data.
Throws:
DhtException
java.util.concurrent.TimeoutException

remove

public void remove(RepositoryName name,
                   RepositoryKey key)
            throws DhtException,
                   java.util.concurrent.TimeoutException
Description copied from interface: RepositoryIndexTable
Remove the association of a name to an identifier.

This method must use some sort of transaction system to ensure the name is removed only if it currently references key. This may require running some sort of lock management service in parallel to the database.

Specified by:
remove in interface RepositoryIndexTable
Parameters:
name - name of the repository.
key - internal key defining the repository.
Throws:
DhtException
java.util.concurrent.TimeoutException


Copyright © 2011. All Rights Reserved.