Class PlannerCache

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class PlannerCache
    extends Data
    implements java.lang.Cloneable
    A data class that is used to track the various files placed by the mapper on the staging sites for the workflow. The url's are stored into a memory based Replica Catalog instance, dependant upon type ( get | put URL ).
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Field Detail

      • PLANNER_CACHE_REPLICA_CATALOG_KEY

        public static final java.lang.String PLANNER_CACHE_REPLICA_CATALOG_KEY
        The name of the source key for Replica Catalog Implementer that serves as cache
        See Also:
        Constant Field Values
      • PLANNER_CACHE_REPLICA_CATALOG_IMPLEMENTER

        public static final java.lang.String PLANNER_CACHE_REPLICA_CATALOG_IMPLEMENTER
        The name of the Replica Catalog Implementer that serves as the source for cache files.
        See Also:
        Constant Field Values
      • mGetRCCache

        private ReplicaCatalog mGetRCCache
        The cache storing the GET urls for the files in the workflow
      • mPutRCCache

        private ReplicaCatalog mPutRCCache
        The cache storing the PUT urls for the files in the workflow
    • Constructor Detail

      • PlannerCache

        public PlannerCache()
        The default constructor.
    • Method Detail

      • toString

        public java.lang.String toString()
        Description copied from class: Data
        Returns the String version of the data object, which is in human readable form.
        Specified by:
        toString in class Data
        Returns:
      • initialize

        public void initialize​(PegasusBag bag,
                               ADag dag)
        Initialize the replica catalog instances that make up the cache.
        Parameters:
        bag -
        dag -
      • insert

        public int insert​(java.lang.String lfn,
                          java.lang.String pfn,
                          java.lang.String handle,
                          FileServerType.OPERATION type)
        Inserts a new entry into the cache.
        Parameters:
        lfn - is the logical filename under which to book the entry.
        pfn - is the physical filename associated with it.
        handle - is a resource handle where the PFN resides.
        type - the type of URL.
        Returns:
        number of insertions, should always be 1. On failure, throw an exception, don't use zero.
      • lookup

        public ReplicaCatalogEntry lookup​(java.lang.String lfn,
                                          FileServerType.OPERATION type)
        Retrieves all entries for a given LFN from the replica catalog. Each entry in the result set is a tuple of a PFN and all its attributes.
        Parameters:
        lfn - is the logical filename to obtain information for.
        type - the type of URL.
        Returns:
        the first matching entry
        See Also:
        ReplicaCatalogEntry
      • lookup

        public java.lang.String lookup​(java.lang.String lfn,
                                       java.lang.String handle,
                                       FileServerType.OPERATION type)
        Retrieves the entry for a given filename and resource handle from the replica catalog.
        Parameters:
        lfn - is the logical filename to obtain information for.
        handle - is the resource handle to obtain entries for.
        type - the type of URL.
        Returns:
        the (first) matching physical filename, or null if no match was found.
      • close

        public void close()
        Explicitely free resources before the garbage collection hits.
      • intializeRCAsCache

        private ReplicaCatalog intializeRCAsCache​(ADag dag,
                                                  FileServerType.OPERATION type)
        Initializes the transient replica catalog and returns a handle to it.
        Parameters:
        dag - the workflow being planned
        type - the url type that will be stored
        Returns:
        handle to transient catalog
      • getCacheFileName

        private java.lang.String getCacheFileName​(ADag adag,
                                                  FileServerType.OPERATION operation)
        Constructs the basename to the cache file that is to be used to log the transient files. The basename is dependant on whether the basename prefix has been specified at runtime or not.
        Parameters:
        adag - the ADag object containing the workflow that is being concretized.
        Returns:
        the name of the cache file