Package org.apache.hadoop.fs.viewfs

Class ViewFileSystemUtil

java.lang.Object
org.apache.hadoop.fs.viewfs.ViewFileSystemUtil

@Public @Evolving public final class ViewFileSystemUtil extends Object
Utility APIs for ViewFileSystem.
  • Method Details

    • isViewFileSystem

      public static boolean isViewFileSystem(FileSystem fileSystem)
      Check if the FileSystem is a ViewFileSystem.
      Parameters:
      fileSystem - file system.
      Returns:
      true if the fileSystem is ViewFileSystem
    • isViewFileSystemOverloadScheme

      public static boolean isViewFileSystemOverloadScheme(FileSystem fileSystem)
      Check if the FileSystem is a ViewFileSystemOverloadScheme.
      Parameters:
      fileSystem - file system.
      Returns:
      true if the fileSystem is ViewFileSystemOverloadScheme
    • getStatus

      public static Map<org.apache.hadoop.fs.viewfs.ViewFileSystem.MountPoint,FsStatus> getStatus(FileSystem fileSystem, Path path) throws IOException
      Get FsStatus for all ViewFsMountPoints matching path for the given ViewFileSystem. Say ViewFileSystem has following mount points configured (1) hdfs://NN0_host:port/sales mounted on /dept/sales (2) hdfs://NN1_host:port/marketing mounted on /dept/marketing (3) hdfs://NN2_host:port/eng_usa mounted on /dept/eng/usa (4) hdfs://NN3_host:port/eng_asia mounted on /dept/eng/asia For the above config, here is a sample list of paths and their matching mount points while getting FsStatus Path Description Matching MountPoint "/" Root ViewFileSystem lists all (1), (2), (3), (4) mount points. "/dept" Not a mount point, but a valid (1), (2), (3), (4) internal dir in the mount tree and resolved down to "/" path. "/dept/sales" Matches a mount point (1) "/dept/sales/india" Path is over a valid mount point (1) and resolved down to "/dept/sales" "/dept/eng" Not a mount point, but a valid (1), (2), (3), (4) internal dir in the mount tree and resolved down to "/" path. "/erp" Doesn't match or leads to or over any valid mount points None
      Parameters:
      fileSystem - - ViewFileSystem on which mount point exists
      path - - URI for which FsStatus is requested
      Returns:
      Map of ViewFsMountPoint and FsStatus
      Throws:
      IOException - raised on errors performing I/O.