org.ourgrid.mygrid.scheduler
Class DataDiscovery

java.lang.Object
  extended by org.ourgrid.mygrid.scheduler.DataDiscovery

public class DataDiscovery
extends java.lang.Object

This is the Data Discovery class. It generates a record of all successful file transfers resulting from STORE directives defined in Job Description Files. This list is made available to Storage Affinity for ([file size] + [location]) discovery.


Field Summary
static long DEFAULT_DURATION
          Duration of entry validity.
 
Method Summary
 long amountAtDestination(java.lang.String localPath, java.lang.String remotePath, GumClient gumClient)
          Determines whether a file is at a specific location
 DataDiscoveryEntry getDDEntry(java.lang.String fileDigest)
          Retrieves an entry for a given file digest
static DataDiscovery getInstance()
          Allow other objects to use the same DD instance
static DataDiscovery initDataDiscovery(boolean cacheFile)
          Instantiate the Data Discovery lookup table
 void modDDEntry(java.lang.String fileDigest, java.lang.String remotePath, GumSpec spec)
          Removes invalid locations from an entry and deletes an entry if its location sub-table is empty.
 int numberOfEntries()
          Determines the number of unique files listed in the Data Discovery table
 void putDDEntry(java.lang.String fileDigest, java.lang.String remotePath, long fileSize, GumClient gum)
          Records STORE file transfer activity for repeated transfers.
 void putDDEntry(java.lang.String fileDigest, java.lang.String remotePath, long fileSize, GumSpec spec)
          Records STORE file transfer activity for repeated transfers.
static void resetInstance()
          Erases the DataDiscovery lookup table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DURATION

public static final long DEFAULT_DURATION
Duration of entry validity. Not yet used.

See Also:
Constant Field Values
Method Detail

initDataDiscovery

public static DataDiscovery initDataDiscovery(boolean cacheFile)
                                       throws DDInitException
Instantiate the Data Discovery lookup table

Throws:
DDInitException

resetInstance

public static void resetInstance()
Erases the DataDiscovery lookup table.


getInstance

public static DataDiscovery getInstance()
Allow other objects to use the same DD instance

Returns:
the current DD instance

putDDEntry

public void putDDEntry(java.lang.String fileDigest,
                       java.lang.String remotePath,
                       long fileSize,
                       GumSpec spec)
Records STORE file transfer activity for repeated transfers. If an entry for the file already exists, the location information is updated.

Parameters:
fileDigest - Digest of a transfered file. Used as primary key.
remotePath - Destination file system path of transfered file.
fileSize - The size in bytes of the file transfered.
spec - The destination GuM's specification

putDDEntry

public void putDDEntry(java.lang.String fileDigest,
                       java.lang.String remotePath,
                       long fileSize,
                       GumClient gum)
Records STORE file transfer activity for repeated transfers. If an entry for the file already exists, the location information is updated.

Parameters:
fileDigest - Digest of a transfered file. Used as primary key.
remotePath - Destination file system path of transfered file.
fileSize - The size in bytes of the file transfered.
gum - The destination GuM's specification

getDDEntry

public DataDiscoveryEntry getDDEntry(java.lang.String fileDigest)
                              throws DDEntryNotFoundException
Retrieves an entry for a given file digest

Parameters:
fileDigest - Digest of a transfered file.
Returns:
DataDiscoveryEntry
Throws:
DDEntryNotFoundException

modDDEntry

public void modDDEntry(java.lang.String fileDigest,
                       java.lang.String remotePath,
                       GumSpec spec)
Removes invalid locations from an entry and deletes an entry if its location sub-table is empty.

Parameters:
fileDigest - Digest of a transfered file.
remotePath - Destination file system path of transfered file.
spec - The destination GuM's specification.

numberOfEntries

public int numberOfEntries()
Determines the number of unique files listed in the Data Discovery table

Returns:
number of entries

amountAtDestination

public long amountAtDestination(java.lang.String localPath,
                                java.lang.String remotePath,
                                GumClient gumClient)
Determines whether a file is at a specific location

Parameters:
localPath - Local file system path of transfered file.
remotePath - Destination file system path of transfered file.
gumClient - Destination GuM
Returns:
size of the file if found, 0 if not found