dk.netarkivet.common.distribute.indexserver
Class TrivialJobIndexCache

java.lang.Object
  extended by dk.netarkivet.common.distribute.indexserver.TrivialJobIndexCache
All Implemented Interfaces:
JobIndexCache

public class TrivialJobIndexCache
extends java.lang.Object
implements JobIndexCache

A trivial JobIndexCache implementation that just assumes somebody places the indexes in the right place (in TrivialJobIndexCache under the cache dir).


Constructor Summary
TrivialJobIndexCache(RequestType t)
          Construct a trivial cache that requires manual setup of files.
 
Method Summary
 Index<java.util.Set<java.lang.Long>> getIndex(java.util.Set<java.lang.Long> jobIDs)
          Get an index for the given list of job IDs.
 void requestIndex(java.util.Set<java.lang.Long> jobSet, java.lang.Long harvestId)
          Request an index from the indexserver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrivialJobIndexCache

public TrivialJobIndexCache(RequestType t)
Construct a trivial cache that requires manual setup of files. The directory that the files are to be put into will be created by this method.

Method Detail

getIndex

public Index<java.util.Set<java.lang.Long>> getIndex(java.util.Set<java.lang.Long> jobIDs)
Get an index for the given list of job IDs. The resulting file contains a suitably sorted list. This method should always be safe for asynchronous calling. This method may use a cached version of the file.

Specified by:
getIndex in interface JobIndexCache
Parameters:
jobIDs - Set of job IDs to generate index for.
Returns:
A file containing the index, and always the full set. The file must not be modified or deleted, since it is part of the cache of data.
Throws:
IOFailure - if there is no cache file for the set.

requestIndex

public void requestIndex(java.util.Set<java.lang.Long> jobSet,
                         java.lang.Long harvestId)
Description copied from interface: JobIndexCache
Request an index from the indexserver. Prepare the indx but don't give it to me.

Specified by:
requestIndex in interface JobIndexCache