Class FileSystemCache

    • Constructor Detail

      • FileSystemCache

        public FileSystemCache​(GFileSystem rootFS)
        Creates a new FileSystemCache object.
        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.

        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.

        fsrl - FSRLRoot of the desired filesystem.
        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.

        containerFSRL - FSRL location to query for currently mounted filesystem.
        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.

        containerFSRL - FSRL location where a filesystem is already mounted
        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.