Interface VolumeManager

  • All Superinterfaces:
    AutoCloseable
    All Known Implementing Classes:
    VolumeManagerImpl

    public interface VolumeManager
    extends AutoCloseable
    A wrapper around multiple hadoop FileSystem objects, which are assumed to be different volumes. This also concentrates a bunch of meta-operations like waiting for SAFE_MODE, and closing WALs. N.B. implementations must be thread safe.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  VolumeManager.FileType  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger log  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void bulkRename​(Map<org.apache.hadoop.fs.Path,​org.apache.hadoop.fs.Path> oldToNewPathMap, int poolSize, String poolName, String transactionId)
      Rename lots of files at once in a thread pool and return once all the threads have completed.
      boolean canSyncAndFlush​(org.apache.hadoop.fs.Path path)  
      Set<String> choosable​(VolumeChooserEnvironment env, Set<String> options)  
      String choose​(VolumeChooserEnvironment env, Set<String> options)  
      void close()  
      org.apache.hadoop.fs.FSDataOutputStream create​(org.apache.hadoop.fs.Path dest)  
      org.apache.hadoop.fs.FSDataOutputStream create​(org.apache.hadoop.fs.Path path, boolean b, int int1, short int2, long long1)  
      boolean createNewFile​(org.apache.hadoop.fs.Path writable)  
      org.apache.hadoop.fs.FSDataOutputStream createSyncable​(org.apache.hadoop.fs.Path logPath, int buffersize, short replication, long blockSize)  
      boolean delete​(org.apache.hadoop.fs.Path path)  
      boolean deleteRecursively​(org.apache.hadoop.fs.Path path)  
      boolean exists​(org.apache.hadoop.fs.Path path)  
      short getDefaultReplication​(org.apache.hadoop.fs.Path logPath)  
      org.apache.hadoop.fs.FileStatus getFileStatus​(org.apache.hadoop.fs.Path path)  
      org.apache.hadoop.fs.FileSystem getFileSystemByPath​(org.apache.hadoop.fs.Path path)  
      default Volume getFirst()
      Fetch the first configured instance Volume
      static InstanceId getInstanceIDFromHdfs​(org.apache.hadoop.fs.Path instanceDirectory, org.apache.hadoop.conf.Configuration hadoopConf)  
      Collection<Volume> getVolumes()
      Fetch the configured instance Volumes
      org.apache.hadoop.fs.FileStatus[] globStatus​(org.apache.hadoop.fs.Path path)  
      boolean isReady()  
      org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listFiles​(org.apache.hadoop.fs.Path path, boolean recursive)  
      org.apache.hadoop.fs.FileStatus[] listStatus​(org.apache.hadoop.fs.Path path)  
      org.apache.hadoop.fs.Path matchingFileSystem​(org.apache.hadoop.fs.Path source, Set<String> options)  
      boolean mkdirs​(org.apache.hadoop.fs.Path directory)  
      boolean mkdirs​(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission)  
      boolean moveToTrash​(org.apache.hadoop.fs.Path sourcePath)  
      org.apache.hadoop.fs.FSDataInputStream open​(org.apache.hadoop.fs.Path path)  
      org.apache.hadoop.fs.FSDataOutputStream overwrite​(org.apache.hadoop.fs.Path path)  
      boolean rename​(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.Path newPath)  
    • Field Detail

      • log

        static final org.slf4j.Logger log
    • Method Detail

      • create

        org.apache.hadoop.fs.FSDataOutputStream create​(org.apache.hadoop.fs.Path dest)
                                                throws IOException
        Throws:
        IOException
      • overwrite

        org.apache.hadoop.fs.FSDataOutputStream overwrite​(org.apache.hadoop.fs.Path path)
                                                   throws IOException
        Throws:
        IOException
      • create

        org.apache.hadoop.fs.FSDataOutputStream create​(org.apache.hadoop.fs.Path path,
                                                       boolean b,
                                                       int int1,
                                                       short int2,
                                                       long long1)
                                                throws IOException
        Throws:
        IOException
      • createNewFile

        boolean createNewFile​(org.apache.hadoop.fs.Path writable)
                       throws IOException
        Throws:
        IOException
      • createSyncable

        org.apache.hadoop.fs.FSDataOutputStream createSyncable​(org.apache.hadoop.fs.Path logPath,
                                                               int buffersize,
                                                               short replication,
                                                               long blockSize)
                                                        throws IOException
        Throws:
        IOException
      • deleteRecursively

        boolean deleteRecursively​(org.apache.hadoop.fs.Path path)
                           throws IOException
        Throws:
        IOException
      • getFileStatus

        org.apache.hadoop.fs.FileStatus getFileStatus​(org.apache.hadoop.fs.Path path)
                                               throws IOException
        Throws:
        IOException
      • getFileSystemByPath

        org.apache.hadoop.fs.FileSystem getFileSystemByPath​(org.apache.hadoop.fs.Path path)
      • matchingFileSystem

        org.apache.hadoop.fs.Path matchingFileSystem​(org.apache.hadoop.fs.Path source,
                                                     Set<String> options)
      • listFiles

        org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listFiles​(org.apache.hadoop.fs.Path path,
                                                                                              boolean recursive)
                                                                                       throws IOException
        Throws:
        IOException
      • listStatus

        org.apache.hadoop.fs.FileStatus[] listStatus​(org.apache.hadoop.fs.Path path)
                                              throws IOException
        Throws:
        IOException
      • mkdirs

        boolean mkdirs​(org.apache.hadoop.fs.Path path,
                       org.apache.hadoop.fs.permission.FsPermission permission)
                throws IOException
        Throws:
        IOException
      • open

        org.apache.hadoop.fs.FSDataInputStream open​(org.apache.hadoop.fs.Path path)
                                             throws IOException
        Throws:
        IOException
      • rename

        boolean rename​(org.apache.hadoop.fs.Path path,
                       org.apache.hadoop.fs.Path newPath)
                throws IOException
        Throws:
        IOException
      • bulkRename

        void bulkRename​(Map<org.apache.hadoop.fs.Path,​org.apache.hadoop.fs.Path> oldToNewPathMap,
                        int poolSize,
                        String poolName,
                        String transactionId)
                 throws IOException
        Rename lots of files at once in a thread pool and return once all the threads have completed. This operation should be idempotent to allow calling multiple times in the case of a partial completion.
        Throws:
        IOException
      • moveToTrash

        boolean moveToTrash​(org.apache.hadoop.fs.Path sourcePath)
                     throws IOException
        Throws:
        IOException
      • getDefaultReplication

        short getDefaultReplication​(org.apache.hadoop.fs.Path logPath)
      • globStatus

        org.apache.hadoop.fs.FileStatus[] globStatus​(org.apache.hadoop.fs.Path path)
                                              throws IOException
        Throws:
        IOException
      • canSyncAndFlush

        boolean canSyncAndFlush​(org.apache.hadoop.fs.Path path)
      • getFirst

        default Volume getFirst()
        Fetch the first configured instance Volume
      • getVolumes

        Collection<Volume> getVolumes()
        Fetch the configured instance Volumes
      • getInstanceIDFromHdfs

        static InstanceId getInstanceIDFromHdfs​(org.apache.hadoop.fs.Path instanceDirectory,
                                                org.apache.hadoop.conf.Configuration hadoopConf)