@NotThreadSafe
public abstract class AbstractFileSystem
extends org.apache.hadoop.fs.FileSystem
FileSystem. This class
really just delegates to FileSystem for most operations.
All implementing classes must define isZookeeperMode() which states if fault tolerant is
used and getScheme() for Hadoop's ServiceLoader support.| Modifier and Type | Field and Description |
|---|---|
protected AlluxioConfiguration |
mAlluxioConf |
protected FileSystem |
mFileSystem |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFileSystem()
Constructs a new
AbstractFileSystem instance. |
protected |
AbstractFileSystem(FileSystem fileSystem)
Constructs a new
AbstractFileSystem instance with specified a FileSystem
handler for tests. |
| Modifier and Type | Method and Description |
|---|---|
void |
access(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsAction mode) |
org.apache.hadoop.fs.FSDataOutputStream |
append(org.apache.hadoop.fs.Path path,
int bufferSize,
org.apache.hadoop.util.Progressable progress) |
protected java.net.URI |
canonicalizeUri(java.net.URI uri) |
void |
close() |
org.apache.hadoop.fs.FSDataOutputStream |
create(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
org.apache.hadoop.util.Progressable progress)
Attempts to create a file.
|
org.apache.hadoop.fs.FSDataOutputStream |
createNonRecursive(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
org.apache.hadoop.util.Progressable progress)
Deprecated.
API only for 0.20-append
|
boolean |
delete(org.apache.hadoop.fs.Path path)
Deprecated.
Use
delete(Path, boolean) instead. |
boolean |
delete(org.apache.hadoop.fs.Path path,
boolean recursive)
Attempts to delete the file or directory with the specified path.
|
protected abstract AlluxioURI |
getAlluxioPath(org.apache.hadoop.fs.Path path)
Used to convert hadoop path to Alluxio path.
|
java.lang.String |
getCanonicalServiceName() |
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
getConfigurationFromUri(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf)
Gets the connection configuration from the input uri.
|
long |
getDefaultBlockSize() |
protected int |
getDefaultPort() |
short |
getDefaultReplication() |
org.apache.hadoop.fs.BlockLocation[] |
getFileBlockLocations(org.apache.hadoop.fs.FileStatus file,
long start,
long len) |
org.apache.hadoop.fs.FileStatus |
getFileStatus(org.apache.hadoop.fs.Path path)
If the file does not exist in Alluxio, query it from HDFS.
|
protected abstract org.apache.hadoop.fs.Path |
getFsPath(java.lang.String fsUriHeader,
URIStatus fileStatus)
Used to get FS native path from Alluxio file status.
|
protected abstract java.lang.String |
getFsScheme(java.net.URI fsUri)
Used to get FS scheme.
|
abstract java.lang.String |
getScheme()
Gets the URI scheme that maps to the
FileSystem. |
java.net.URI |
getUri() |
org.apache.hadoop.fs.Path |
getWorkingDirectory() |
void |
initialize(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf)
Sets up a lazy connection to Alluxio through mFileSystem.
|
void |
initialize(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf,
AlluxioConfiguration alluxioConfiguration)
Initialize the
FileSystem. |
protected abstract boolean |
isZookeeperMode()
Deprecated.
in 1.6.0, directly infer the value from
PropertyKey.ZOOKEEPER_ENABLED
configuration value.
Determines if zookeeper should be used for the FileSystem. This
method should only be used for
initialize(java.net.URI, org.apache.hadoop.conf.Configuration). |
org.apache.hadoop.fs.FileStatus[] |
listStatus(org.apache.hadoop.fs.Path path) |
boolean |
mkdirs(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
Attempts to create a folder with the specified path.
|
org.apache.hadoop.fs.FSDataInputStream |
open(org.apache.hadoop.fs.Path path,
int bufferSize)
Attempts to open the specified file for reading.
|
boolean |
rename(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst) |
void |
setOwner(org.apache.hadoop.fs.Path path,
java.lang.String username,
java.lang.String groupname)
Changes owner or group of a path (i.e.
|
void |
setPermission(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
Changes permission of a path.
|
boolean |
setReplication(org.apache.hadoop.fs.Path path,
short replication) |
void |
setWorkingDirectory(org.apache.hadoop.fs.Path path) |
protected abstract void |
validateFsUri(java.net.URI fsUri)
Validates given FS base URI for scheme and authority.
|
append, append, appendFile, areSymlinksEnabled, cancelDeleteOnExit, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, concat, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createFile, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createPathHandle, createSnapshot, createSnapshot, createSymlink, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAclStatus, getAdditionalTokenIssuers, getAllStatistics, getAllStoragePolicies, getBlockSize, getCanonicalUri, getChildFileSystems, getContentSummary, getDefaultBlockSize, getDefaultReplication, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileChecksum, getFileChecksum, getFileLinkStatus, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getHomeDirectory, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getStoragePolicy, getStorageStatistics, getTrashRoot, getTrashRoots, getUsed, getUsed, getXAttr, getXAttrs, getXAttrs, globStatus, globStatus, hasPathCapability, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, listXAttrs, makeQualified, mkdirs, mkdirs, modifyAclEntries, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, msync, newInstance, newInstance, newInstance, newInstanceLocal, open, open, open, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setAcl, setDefaultUri, setDefaultUri, setQuota, setQuotaByStorageType, setStoragePolicy, setTimes, setVerifyChecksum, setWriteChecksum, setXAttr, setXAttr, startLocalOutput, supportsSymlinks, truncate, unsetStoragePolicyprotected AlluxioConfiguration mAlluxioConf
protected FileSystem mFileSystem
protected AbstractFileSystem(FileSystem fileSystem)
AbstractFileSystem instance with specified a FileSystem
handler for tests.fileSystem - handler to file systemprotected AbstractFileSystem()
AbstractFileSystem instance.public void access(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsAction mode)
throws java.io.IOException
access in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic org.apache.hadoop.fs.FSDataOutputStream append(org.apache.hadoop.fs.Path path,
int bufferSize,
org.apache.hadoop.util.Progressable progress)
throws java.io.IOException
append in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
org.apache.hadoop.util.Progressable progress)
throws java.io.IOException
create in class org.apache.hadoop.fs.FileSystempath - path to createpermission - permissions of the created file/folderoverwrite - overwrite if file existsbufferSize - the size in bytes of the buffer to be usedreplication - under filesystem replication factor, this is ignoredblockSize - block size in bytesprogress - queryable progressFSDataOutputStream created at the indicated path of a filejava.io.IOException@Deprecated
public org.apache.hadoop.fs.FSDataOutputStream createNonRecursive(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
org.apache.hadoop.util.Progressable progress)
throws java.io.IOException
FSDataOutputStream at the indicated Path with write-progress reporting.
Same as FileSystem.create(Path, boolean, int, short, long, Progressable), except fails if parent
directory doesn't already exist.
TODO(hy): We need to refactor this method after having a new internal API support (ALLUXIO-46).createNonRecursive in class org.apache.hadoop.fs.FileSystempath - the file name to openoverwrite - if a file with this name already exists, then if true, the file will be
overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be usedreplication - required block replication for the fileblockSize - the size in bytes of the buffer to be usedprogress - queryable progressjava.io.IOExceptionsetPermission(Path, FsPermission)@Deprecated
public boolean delete(org.apache.hadoop.fs.Path path)
throws java.io.IOException
delete(Path, boolean) instead.delete in class org.apache.hadoop.fs.FileSystempath - path to deletejava.io.IOExceptionpublic boolean delete(org.apache.hadoop.fs.Path path,
boolean recursive)
throws java.io.IOException
delete in class org.apache.hadoop.fs.FileSystempath - path to deleterecursive - if true, will attempt to delete all children of the pathjava.io.IOExceptionprotected int getDefaultPort()
getDefaultPort in class org.apache.hadoop.fs.FileSystemprotected java.net.URI canonicalizeUri(java.net.URI uri)
canonicalizeUri in class org.apache.hadoop.fs.FileSystempublic long getDefaultBlockSize()
getDefaultBlockSize in class org.apache.hadoop.fs.FileSystempublic java.lang.String getCanonicalServiceName()
getCanonicalServiceName in interface org.apache.hadoop.security.token.DelegationTokenIssuergetCanonicalServiceName in class org.apache.hadoop.fs.FileSystem@Nullable
public org.apache.hadoop.fs.BlockLocation[] getFileBlockLocations(org.apache.hadoop.fs.FileStatus file,
long start,
long len)
throws java.io.IOException
getFileBlockLocations in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic short getDefaultReplication()
getDefaultReplication in class org.apache.hadoop.fs.FileSystempublic boolean setReplication(org.apache.hadoop.fs.Path path,
short replication)
throws java.io.IOException
setReplication in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path path)
throws java.io.IOException
getFileStatus in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic void setOwner(org.apache.hadoop.fs.Path path,
java.lang.String username,
java.lang.String groupname)
throws java.io.IOException
setOwner in class org.apache.hadoop.fs.FileSystempath - path to set owner or groupusername - username to be setgroupname - groupname to be setjava.io.IOExceptionpublic void setPermission(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
throws java.io.IOException
setPermission in class org.apache.hadoop.fs.FileSystempath - path to set permissionpermission - permission set to pathjava.io.IOExceptionpublic abstract java.lang.String getScheme()
FileSystem. This was
introduced in Hadoop 2.x as a means to make loading new FileSystem
s simpler.getScheme in class org.apache.hadoop.fs.FileSystemFileSystem.createFileSystem(java.net.URI,
org.apache.hadoop.conf.Configuration)public java.net.URI getUri()
getUri in class org.apache.hadoop.fs.FileSystempublic org.apache.hadoop.fs.Path getWorkingDirectory()
getWorkingDirectory in class org.apache.hadoop.fs.FileSystempublic void initialize(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
initialize in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic void initialize(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf,
@Nullable
AlluxioConfiguration alluxioConfiguration)
throws java.io.IOException
FileSystem.uri - file system Uriconf - hadoop configurationalluxioConfiguration - [optional] alluxio configurationjava.io.IOException@Deprecated protected abstract boolean isZookeeperMode()
PropertyKey.ZOOKEEPER_ENABLED
configuration value.
Determines if zookeeper should be used for the FileSystem. This
method should only be used for
initialize(java.net.URI, org.apache.hadoop.conf.Configuration).public org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path path)
throws java.io.IOException
listStatus in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic boolean mkdirs(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
throws java.io.IOException
mkdirs in class org.apache.hadoop.fs.FileSystempath - path to createpermission - permissions to grant the created folderjava.io.IOExceptionpublic org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path path,
int bufferSize)
throws java.io.IOException
open in class org.apache.hadoop.fs.FileSystempath - the file name to openbufferSize - stream buffer size in bytes, currently unusedFSDataInputStream at the indicated path of a filejava.io.IOExceptionpublic boolean rename(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst)
throws java.io.IOException
rename in class org.apache.hadoop.fs.FileSystemjava.io.IOExceptionpublic void setWorkingDirectory(org.apache.hadoop.fs.Path path)
setWorkingDirectory in class org.apache.hadoop.fs.FileSystemprotected abstract java.util.Map<java.lang.String,java.lang.Object> getConfigurationFromUri(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf)
uri - an Alluxio Uri that may contain connection configurationprotected abstract void validateFsUri(java.net.URI fsUri)
throws java.io.IOException,
java.lang.IllegalArgumentException
fsUri - FS Urijava.io.IOExceptionjava.lang.IllegalArgumentExceptionprotected abstract java.lang.String getFsScheme(java.net.URI fsUri)
fsUri - file system base URIprotected abstract AlluxioURI getAlluxioPath(org.apache.hadoop.fs.Path path)
path - the input pathprotected abstract org.apache.hadoop.fs.Path getFsPath(java.lang.String fsUriHeader,
URIStatus fileStatus)
fsUriHeader - FS URI header -> "scheme://authority"fileStatus - Alluxio file statusCopyright © 2023. All Rights Reserved.