Class LocalFileCacheClient

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.gorpipe.client.FileCache
    Direct Known Subclasses:
    NoCacheFileCacheClient

    public class LocalFileCacheClient
    extends java.lang.Object
    implements org.gorpipe.client.FileCache
    Local implementation of file cache client working directly against the file system. This can be used for non server implementations of file cache.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocalFileCacheClient​(java.nio.file.Path rootPath)  
      LocalFileCacheClient​(java.nio.file.Path rootPath, boolean useSubFolders, int subFolderSize)
      Constructs an instance of local file cache.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.lang.String lookupFile​(java.lang.String fingerprint)  
      java.lang.String[] multiLookup​(java.lang.String[] fingerprints, boolean defer)  
      java.lang.String store​(java.nio.file.Path from, java.lang.String fingerprint, java.lang.String ext, long cost)  
      java.lang.String storeSibling​(java.nio.file.Path path, java.lang.String fingerprint)  
      java.lang.String storeWithSpecificCacheFilename​(java.nio.file.Path path, java.lang.String fingerprint, java.lang.String cacheFilename, long cost)  
      java.lang.String tempLocation​(java.lang.String fingerprint, java.lang.String ext)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalFileCacheClient

        public LocalFileCacheClient​(java.nio.file.Path rootPath,
                                    boolean useSubFolders,
                                    int subFolderSize)
        Constructs an instance of local file cache. If sub folders are used the first subFolderSize letters of the fingerprint are used to create a sub folder storing the result file.
        Parameters:
        rootPath - File cache location
        useSubFolders - Inserts sub folders for fingerprints.
        subFolderSize - Insers sub folders for fingerprints.
      • LocalFileCacheClient

        public LocalFileCacheClient​(java.nio.file.Path rootPath)
    • Method Detail

      • lookupFile

        public java.lang.String lookupFile​(java.lang.String fingerprint)
        Specified by:
        lookupFile in interface org.gorpipe.client.FileCache
      • store

        public java.lang.String store​(java.nio.file.Path from,
                                      java.lang.String fingerprint,
                                      java.lang.String ext,
                                      long cost)
        Specified by:
        store in interface org.gorpipe.client.FileCache
      • storeWithSpecificCacheFilename

        public java.lang.String storeWithSpecificCacheFilename​(java.nio.file.Path path,
                                                               java.lang.String fingerprint,
                                                               java.lang.String cacheFilename,
                                                               long cost)
        Specified by:
        storeWithSpecificCacheFilename in interface org.gorpipe.client.FileCache
      • storeSibling

        public java.lang.String storeSibling​(java.nio.file.Path path,
                                             java.lang.String fingerprint)
        Specified by:
        storeSibling in interface org.gorpipe.client.FileCache
      • tempLocation

        public java.lang.String tempLocation​(java.lang.String fingerprint,
                                             java.lang.String ext)
        Specified by:
        tempLocation in interface org.gorpipe.client.FileCache
      • multiLookup

        public java.lang.String[] multiLookup​(java.lang.String[] fingerprints,
                                              boolean defer)
        Specified by:
        multiLookup in interface org.gorpipe.client.FileCache
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception