Class InodeTree<T>

java.lang.Object
org.apache.hadoop.fs.viewfs.InodeTree<T>
Type Parameters:
T - is AbstractFileSystem or FileSystem The two main methods are InodeTree(Configuration, String, URI, boolean) // constructor resolve(String, boolean)

@Private @Unstable public abstract class InodeTree<T> extends Object
InodeTree implements a mount-table as a tree of inodes. It is used to implement ViewFs and ViewFileSystem. In order to use it the caller must subclass it and implement the abstract methods getTargetFileSystem(INodeDir), etc. The mountable is initialized from the config variables as specified in ViewFs
  • Constructor Details

  • Method Details

    • initAndGetTargetFs

      protected abstract Function<URI,T> initAndGetTargetFs()
      The user of this class must subclass and implement the following 3 abstract methods.
      Returns:
      Function.
    • getTargetFileSystem

      protected abstract T getTargetFileSystem(org.apache.hadoop.fs.viewfs.InodeTree.INodeDir<T> dir) throws URISyntaxException, IOException
      Throws:
      URISyntaxException
      IOException
    • getTargetFileSystem

      protected abstract T getTargetFileSystem(String settings, URI[] mergeFsURIs) throws UnsupportedFileSystemException, URISyntaxException, IOException
      Throws:
      UnsupportedFileSystemException
      URISyntaxException
      IOException
    • isRootInternalDir

      public boolean isRootInternalDir()
      Returns:
      true if the root represented as internalDir. In LinkMergeSlash, there will be root to root mapping. So, root does not represent as internalDir.
    • getRootFallbackLink

      public InodeTree.INodeLink<T> getRootFallbackLink()
    • resolve

      public InodeTree.ResolveResult<T> resolve(String p, boolean resolveLastComponent) throws IOException
      Resolve the pathname p relative to root InodeDir.
      Parameters:
      p - - input path
      resolveLastComponent - resolveLastComponent.
      Returns:
      ResolveResult which allows further resolution of the remaining path
      Throws:
      IOException - raised on errors performing I/O.
    • tryResolveInRegexMountpoint

      protected InodeTree.ResolveResult<T> tryResolveInRegexMountpoint(String srcPath, boolean resolveLastComponent)
      Walk through all regex mount points to see whether the path match any regex expressions. E.g. link: ^/user/(?<username>\\w+) => s3://$user.apache.com/_${user} srcPath: is /user/hadoop/dir1 resolveLastComponent: true then return value is s3://hadoop.apache.com/_hadoop
      Parameters:
      srcPath - srcPath.
      resolveLastComponent - resolveLastComponent.
      Returns:
      ResolveResult.
    • buildResolveResultForRegexMountPoint

      protected InodeTree.ResolveResult<T> buildResolveResultForRegexMountPoint(org.apache.hadoop.fs.viewfs.InodeTree.ResultKind resultKind, String resolvedPathStr, String targetOfResolvedPathStr, Path remainingPath)
      Build resolve result. Here's an example Mountpoint: fs.viewfs.mounttable.mt .linkRegex.replaceresolveddstpath:_:-#.^/user/(??<username>\w+) Value: /targetTestRoot/$username Dir path to test: viewfs://mt/user/hadoop_user1/hadoop_dir1 Expect path: /targetTestRoot/hadoop-user1/hadoop_dir1 resolvedPathStr: /user/hadoop_user1 targetOfResolvedPathStr: /targetTestRoot/hadoop-user1 remainingPath: /hadoop_dir1
      Parameters:
      resultKind - resultKind.
      resolvedPathStr - resolvedPathStr.
      targetOfResolvedPathStr - targetOfResolvedPathStr.
      remainingPath - remainingPath.
      Returns:
      targetFileSystem or null on exceptions.
    • getMountPoints

      public List<InodeTree.MountPoint<T>> getMountPoints()
    • getHomeDirPrefixValue

      public String getHomeDirPrefixValue()
      Returns:
      home dir value from mount table; null if no config value was found.