Class FileSystemCache

    • Constructor Detail

      • FileSystemCache

        public FileSystemCache​(GFileSystem rootFS)
        Creates a new FileSystemCache object.
        Parameters:
        rootFS - reference to the global root file system, which is a special case file system that is not subject to eviction.
    • Method Detail

      • clear

        public void clear()
        Forcefully closes any filesystems in the cache, then clears the list of cached filesystems.
      • closeAllUnused

        public void closeAllUnused()
        Removes any unused filesystems in the cache.
      • getMountedFilesystems

        public java.util.List<FSRLRoot> getMountedFilesystems()
        Returns a list of mounted file systems.

        Returns:
        List of FSRLRoot of filesystems that are currently mounted.
      • getRef

        public FileSystemRef getRef​(FSRLRoot fsrl)
        Returns a new FileSystemRef to an existing, already open filesystem. Caller is responsible for closing it.

        Returns NULL if the requested filesystem isn't already open and mounted in the cache.

        Parameters:
        fsrl - FSRLRoot of the desired filesystem.
        Returns:
        a new FileSystemRef or null if the filesystem is not currently mounted.
      • isFilesystemMountedAt

        public boolean isFilesystemMountedAt​(FSRL containerFSRL)
        Returns true if there is a filesystem in the cache that has a containerFSRL that is equiv to the specified FSRL.

        Parameters:
        containerFSRL - FSRL location to query for currently mounted filesystem.
        Returns:
        true if there is a filesystem mounted using that containerFSRL.
      • getFilesystemRefMountedAt

        public FileSystemRef getFilesystemRefMountedAt​(FSRL containerFSRL)
        Returns a new FileSystemRef to a already mounted filesystem (keeping the filesystem pinned in memory without the risk of it being closed during a race condition).

        The caller is responsible for closing it when done.

        Returns null if there is no filesystem mounted at the requested container fsrl.

        Parameters:
        containerFSRL - FSRL location where a filesystem is already mounted
        Returns:
        new FileSystemRef to the already mounted filesystem, or null
      • cacheMaint

        public void cacheMaint()
        Performs maintainence on the filesystem cache, closing() any filesystems that are not used anymore.