Interface FunctionCacheManager

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    FunctionCacheManagerImpl

    public interface FunctionCacheManager
    extends java.lang.AutoCloseable
    A cache manager for caching function code and its dependencies.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void close()
      Close the cache manager to release created class loaders.
      java.lang.ClassLoader getClassLoader​(java.lang.String fid)
      Returns the function code class loader associated with id.
      default void registerFunction​(java.lang.String fid, java.util.List<java.lang.String> requiredJarFiles, java.util.List<java.net.URL> requiredClasspaths)
      Registers a function with its required jar files and classpaths.
      void registerFunctionInstance​(java.lang.String fid, java.lang.String eid, java.util.List<java.lang.String> requiredJarFiles, java.util.List<java.net.URL> requiredClasspaths)  
      void registerFunctionInstanceWithArchive​(java.lang.String fid, java.lang.String eid, java.lang.String narArchive, java.lang.String narExtractionDirectory)  
      default void unregisterFunction​(java.lang.String fid)
      Unregisters a job from the function cache manager.
      void unregisterFunctionInstance​(java.lang.String fid, java.lang.String eid)  
    • Method Detail

      • getClassLoader

        java.lang.ClassLoader getClassLoader​(java.lang.String fid)
        Returns the function code class loader associated with id.
        Parameters:
        fid - function id
        Returns:
        class loader which can load the function code.
      • registerFunction

        default void registerFunction​(java.lang.String fid,
                                      java.util.List<java.lang.String> requiredJarFiles,
                                      java.util.List<java.net.URL> requiredClasspaths)
                               throws java.io.IOException
        Registers a function with its required jar files and classpaths.

        The jar files are identified by their blob keys and downloaded for use by a ClassLoader.

        Parameters:
        fid - function id
        requiredJarFiles - collection of blob keys identifying the required jar files.
        requiredClasspaths - collection of classpaths that are added to the function code class loader.
        Throws:
        java.io.IOException
      • registerFunctionInstance

        void registerFunctionInstance​(java.lang.String fid,
                                      java.lang.String eid,
                                      java.util.List<java.lang.String> requiredJarFiles,
                                      java.util.List<java.net.URL> requiredClasspaths)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • registerFunctionInstanceWithArchive

        void registerFunctionInstanceWithArchive​(java.lang.String fid,
                                                 java.lang.String eid,
                                                 java.lang.String narArchive,
                                                 java.lang.String narExtractionDirectory)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • unregisterFunction

        default void unregisterFunction​(java.lang.String fid)
        Unregisters a job from the function cache manager.
        Parameters:
        fid - function id
      • unregisterFunctionInstance

        void unregisterFunctionInstance​(java.lang.String fid,
                                        java.lang.String eid)
      • close

        void close()
        Close the cache manager to release created class loaders.
        Specified by:
        close in interface java.lang.AutoCloseable