Package alluxio.underfs.hdfs
Class HdfsUnderFileSystem
- java.lang.Object
-
- alluxio.underfs.BaseUnderFileSystem
-
- alluxio.underfs.ConsistentUnderFileSystem
-
- alluxio.underfs.hdfs.HdfsUnderFileSystem
-
- All Implemented Interfaces:
alluxio.underfs.AtomicFileOutputStreamCallback,alluxio.underfs.UnderFileSystem,java.io.Closeable,java.lang.AutoCloseable
@ThreadSafe public class HdfsUnderFileSystem extends alluxio.underfs.ConsistentUnderFileSystem implements alluxio.underfs.AtomicFileOutputStreamCallbackHDFSUnderFileSystemimplementation.
-
-
Constructor Summary
Constructors Constructor Description HdfsUnderFileSystem(alluxio.AlluxioURI ufsUri, alluxio.underfs.UnderFileSystemConfiguration conf, org.apache.hadoop.conf.Configuration hdfsConf)Constructs a new HDFSUnderFileSystem.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()voidclose()voidconnectFromMaster(java.lang.String host)voidconnectFromWorker(java.lang.String host)java.io.OutputStreamcreate(java.lang.String path, alluxio.underfs.options.CreateOptions options)static org.apache.hadoop.conf.ConfigurationcreateConfiguration(alluxio.underfs.UnderFileSystemConfiguration conf)Prepares the Hadoop configuration necessary to successfully obtain aFileSysteminstance that can access the provided path.java.io.OutputStreamcreateDirect(java.lang.String path, alluxio.underfs.options.CreateOptions options)static HdfsUnderFileSystemcreateInstance(alluxio.AlluxioURI ufsUri, alluxio.underfs.UnderFileSystemConfiguration conf)Factory method to constructs a new HDFSUnderFileSysteminstance.booleandeleteDirectory(java.lang.String path, alluxio.underfs.options.DeleteOptions options)booleandeleteFile(java.lang.String path)booleanexists(java.lang.String path)alluxio.collections.Pair<alluxio.security.authorization.AccessControlList,alluxio.security.authorization.DefaultAccessControlList>getAclPair(java.lang.String path)alluxio.SyncInfogetActiveSyncInfo()longgetBlockSizeByte(java.lang.String path)alluxio.underfs.UfsDirectoryStatusgetDirectoryStatus(java.lang.String path)java.util.List<java.lang.String>getFileLocations(java.lang.String path)java.util.List<java.lang.String>getFileLocations(java.lang.String path, alluxio.underfs.options.FileLocationOptions options)alluxio.underfs.UfsFileStatusgetFileStatus(java.lang.String path)longgetSpace(java.lang.String path, alluxio.underfs.UnderFileSystem.SpaceType type)alluxio.underfs.UfsStatusgetStatus(java.lang.String path)java.lang.StringgetUnderFSType()booleanisDirectory(java.lang.String path)booleanisFile(java.lang.String path)booleanisSeekable()alluxio.underfs.UfsStatus[]listStatus(java.lang.String path)booleanmkdirs(java.lang.String path, alluxio.underfs.options.MkdirsOptions options)java.io.InputStreamopen(java.lang.String path, alluxio.underfs.options.OpenOptions options)HdfsPositionedUnderFileInputStreamopenPositionRead(java.lang.String path, long fileLength)booleanrenameDirectory(java.lang.String src, java.lang.String dst)booleanrenameFile(java.lang.String src, java.lang.String dst)voidsetAclEntries(java.lang.String path, java.util.List<alluxio.security.authorization.AclEntry> aclEntries)voidsetMode(java.lang.String path, short mode)voidsetOwner(java.lang.String path, java.lang.String user, java.lang.String group)booleanstartActiveSyncPolling(long txId)voidstartSync(alluxio.AlluxioURI ufsUri)booleanstopActiveSyncPolling()voidstopSync(alluxio.AlluxioURI ufsUri)booleansupportsActiveSync()booleansupportsFlush()-
Methods inherited from class alluxio.underfs.ConsistentUnderFileSystem
createNonexistingFile, createNonexistingFile, deleteExistingDirectory, deleteExistingDirectory, deleteExistingFile, getExistingDirectoryStatus, getExistingFileStatus, getExistingStatus, isExistingDirectory, openExistingFile, openExistingFile, renameRenamableDirectory, renameRenamableFile
-
Methods inherited from class alluxio.underfs.BaseUnderFileSystem
create, deleteDirectory, getConfiguration, getFingerprint, getOperationMode, getParsedFingerprint, getPhysicalStores, isObjectStorage, listStatus, mkdirs, open, resolveUri, validatePath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface alluxio.underfs.UnderFileSystem
create, createNonexistingFile, createNonexistingFile, deleteDirectory, deleteExistingDirectory, deleteExistingDirectory, deleteExistingFile, getConfiguration, getExistingDirectoryStatus, getExistingFileStatus, getExistingStatus, getFingerprint, getOperationMode, getParsedFingerprint, getPhysicalStores, isExistingDirectory, isObjectStorage, listStatus, listStatuses, mkdirs, open, openExistingFile, openExistingFile, renameRenamableDirectory, renameRenamableFile, resolveUri
-
-
-
-
Constructor Detail
-
HdfsUnderFileSystem
public HdfsUnderFileSystem(alluxio.AlluxioURI ufsUri, alluxio.underfs.UnderFileSystemConfiguration conf, org.apache.hadoop.conf.Configuration hdfsConf)Constructs a new HDFSUnderFileSystem.- Parameters:
ufsUri- theAlluxioURIfor this UFSconf- the configuration for this UFShdfsConf- the configuration for HDFS
-
-
Method Detail
-
createInstance
public static HdfsUnderFileSystem createInstance(alluxio.AlluxioURI ufsUri, alluxio.underfs.UnderFileSystemConfiguration conf)
Factory method to constructs a new HDFSUnderFileSysteminstance.- Parameters:
ufsUri- theAlluxioURIfor this UFSconf- the configuration for Hadoop- Returns:
- a new HDFS
UnderFileSysteminstance
-
getUnderFSType
public java.lang.String getUnderFSType()
- Specified by:
getUnderFSTypein interfacealluxio.underfs.UnderFileSystem
-
createConfiguration
public static org.apache.hadoop.conf.Configuration createConfiguration(alluxio.underfs.UnderFileSystemConfiguration conf)
Prepares the Hadoop configuration necessary to successfully obtain aFileSysteminstance that can access the provided path.Derived implementations that work with specialised Hadoop FileSystem API compatible implementations can override this method to add implementation specific configuration necessary for obtaining a usable FileSystem instance.
- Parameters:
conf- the configuration for this UFS- Returns:
- the configuration for HDFS
-
cleanup
public void cleanup()
- Specified by:
cleanupin interfacealluxio.underfs.UnderFileSystem
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
create
public java.io.OutputStream create(java.lang.String path, alluxio.underfs.options.CreateOptions options) throws java.io.IOException- Specified by:
createin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
createDirect
public java.io.OutputStream createDirect(java.lang.String path, alluxio.underfs.options.CreateOptions options) throws java.io.IOException- Specified by:
createDirectin interfacealluxio.underfs.AtomicFileOutputStreamCallback- Throws:
java.io.IOException
-
deleteDirectory
public boolean deleteDirectory(java.lang.String path, alluxio.underfs.options.DeleteOptions options) throws java.io.IOException- Specified by:
deleteDirectoryin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
deleteFile
public boolean deleteFile(java.lang.String path) throws java.io.IOException- Specified by:
deleteFilein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String path) throws java.io.IOException- Specified by:
existsin interfacealluxio.underfs.UnderFileSystem- Overrides:
existsin classalluxio.underfs.BaseUnderFileSystem- Throws:
java.io.IOException
-
getAclPair
public alluxio.collections.Pair<alluxio.security.authorization.AccessControlList,alluxio.security.authorization.DefaultAccessControlList> getAclPair(java.lang.String path) throws java.io.IOException- Specified by:
getAclPairin interfacealluxio.underfs.UnderFileSystem- Overrides:
getAclPairin classalluxio.underfs.BaseUnderFileSystem- Throws:
java.io.IOException
-
setAclEntries
public void setAclEntries(java.lang.String path, java.util.List<alluxio.security.authorization.AclEntry> aclEntries) throws java.io.IOException- Specified by:
setAclEntriesin interfacealluxio.underfs.UnderFileSystem- Overrides:
setAclEntriesin classalluxio.underfs.BaseUnderFileSystem- Throws:
java.io.IOException
-
getBlockSizeByte
public long getBlockSizeByte(java.lang.String path) throws java.io.IOException- Specified by:
getBlockSizeBytein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getDirectoryStatus
public alluxio.underfs.UfsDirectoryStatus getDirectoryStatus(java.lang.String path) throws java.io.IOException- Specified by:
getDirectoryStatusin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getFileLocations
public java.util.List<java.lang.String> getFileLocations(java.lang.String path) throws java.io.IOException- Specified by:
getFileLocationsin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getFileLocations
@Nullable public java.util.List<java.lang.String> getFileLocations(java.lang.String path, alluxio.underfs.options.FileLocationOptions options) throws java.io.IOException- Specified by:
getFileLocationsin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getFileStatus
public alluxio.underfs.UfsFileStatus getFileStatus(java.lang.String path) throws java.io.IOException- Specified by:
getFileStatusin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getSpace
public long getSpace(java.lang.String path, alluxio.underfs.UnderFileSystem.SpaceType type) throws java.io.IOException- Specified by:
getSpacein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
getStatus
public alluxio.underfs.UfsStatus getStatus(java.lang.String path) throws java.io.IOException- Specified by:
getStatusin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
isDirectory
public boolean isDirectory(java.lang.String path) throws java.io.IOException- Specified by:
isDirectoryin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
isFile
public boolean isFile(java.lang.String path) throws java.io.IOException- Specified by:
isFilein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
listStatus
@Nullable public alluxio.underfs.UfsStatus[] listStatus(java.lang.String path) throws java.io.IOException- Specified by:
listStatusin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
connectFromMaster
public void connectFromMaster(java.lang.String host) throws java.io.IOException- Specified by:
connectFromMasterin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
connectFromWorker
public void connectFromWorker(java.lang.String host) throws java.io.IOException- Specified by:
connectFromWorkerin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
mkdirs
public boolean mkdirs(java.lang.String path, alluxio.underfs.options.MkdirsOptions options) throws java.io.IOException- Specified by:
mkdirsin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
open
public java.io.InputStream open(java.lang.String path, alluxio.underfs.options.OpenOptions options) throws java.io.IOException- Specified by:
openin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
openPositionRead
public HdfsPositionedUnderFileInputStream openPositionRead(java.lang.String path, long fileLength)
- Specified by:
openPositionReadin interfacealluxio.underfs.UnderFileSystem
-
renameDirectory
public boolean renameDirectory(java.lang.String src, java.lang.String dst) throws java.io.IOException- Specified by:
renameDirectoryin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
renameFile
public boolean renameFile(java.lang.String src, java.lang.String dst) throws java.io.IOException- Specified by:
renameFilein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
setOwner
public void setOwner(java.lang.String path, java.lang.String user, java.lang.String group) throws java.io.IOException- Specified by:
setOwnerin interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
setMode
public void setMode(java.lang.String path, short mode) throws java.io.IOException- Specified by:
setModein interfacealluxio.underfs.UnderFileSystem- Throws:
java.io.IOException
-
supportsFlush
public boolean supportsFlush()
- Specified by:
supportsFlushin interfacealluxio.underfs.UnderFileSystem
-
supportsActiveSync
public boolean supportsActiveSync()
- Specified by:
supportsActiveSyncin interfacealluxio.underfs.UnderFileSystem- Overrides:
supportsActiveSyncin classalluxio.underfs.BaseUnderFileSystem
-
getActiveSyncInfo
public alluxio.SyncInfo getActiveSyncInfo()
- Specified by:
getActiveSyncInfoin interfacealluxio.underfs.UnderFileSystem- Overrides:
getActiveSyncInfoin classalluxio.underfs.BaseUnderFileSystem
-
startActiveSyncPolling
public boolean startActiveSyncPolling(long txId) throws java.io.IOException- Specified by:
startActiveSyncPollingin interfacealluxio.underfs.UnderFileSystem- Overrides:
startActiveSyncPollingin classalluxio.underfs.BaseUnderFileSystem- Throws:
java.io.IOException
-
stopActiveSyncPolling
public boolean stopActiveSyncPolling()
- Specified by:
stopActiveSyncPollingin interfacealluxio.underfs.UnderFileSystem- Overrides:
stopActiveSyncPollingin classalluxio.underfs.BaseUnderFileSystem
-
startSync
public void startSync(alluxio.AlluxioURI ufsUri)
- Specified by:
startSyncin interfacealluxio.underfs.UnderFileSystem- Overrides:
startSyncin classalluxio.underfs.BaseUnderFileSystem
-
stopSync
public void stopSync(alluxio.AlluxioURI ufsUri)
- Specified by:
stopSyncin interfacealluxio.underfs.UnderFileSystem- Overrides:
stopSyncin classalluxio.underfs.BaseUnderFileSystem
-
isSeekable
public boolean isSeekable()
- Specified by:
isSeekablein interfacealluxio.underfs.UnderFileSystem- Overrides:
isSeekablein classalluxio.underfs.BaseUnderFileSystem
-
-