@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 URI |
canonicalizeUri(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.
|
String |
getCanonicalServiceName() |
protected abstract Map<String,Object> |
getConfigurationFromUri(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(String fsUriHeader,
URIStatus fileStatus)
Used to get FS native path from Alluxio file status.
|
protected abstract String |
getFsScheme(URI fsUri)
Used to get FS scheme.
|
abstract String |
getScheme()
Gets the URI scheme that maps to the
FileSystem . |
URI |
getUri() |
org.apache.hadoop.fs.Path |
getWorkingDirectory() |
void |
initialize(URI uri,
org.apache.hadoop.conf.Configuration conf)
Sets up a lazy connection to Alluxio through mFileSystem.
|
void |
initialize(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,
String username,
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(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, unsetStoragePolicy
protected 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 IOException
access
in class org.apache.hadoop.fs.FileSystem
IOException
public org.apache.hadoop.fs.FSDataOutputStream append(org.apache.hadoop.fs.Path path, int bufferSize, org.apache.hadoop.util.Progressable progress) throws IOException
append
in class org.apache.hadoop.fs.FileSystem
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class org.apache.hadoop.fs.FileSystem
IOException
public 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 IOException
create
in class org.apache.hadoop.fs.FileSystem
path
- 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 fileIOException
@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 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.FileSystem
path
- 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 progressIOException
setPermission(Path, FsPermission)
@Deprecated public boolean delete(org.apache.hadoop.fs.Path path) throws IOException
delete(Path, boolean)
instead.delete
in class org.apache.hadoop.fs.FileSystem
path
- path to deleteIOException
public boolean delete(org.apache.hadoop.fs.Path path, boolean recursive) throws IOException
delete
in class org.apache.hadoop.fs.FileSystem
path
- path to deleterecursive
- if true, will attempt to delete all children of the pathIOException
protected int getDefaultPort()
getDefaultPort
in class org.apache.hadoop.fs.FileSystem
protected URI canonicalizeUri(URI uri)
canonicalizeUri
in class org.apache.hadoop.fs.FileSystem
public long getDefaultBlockSize()
getDefaultBlockSize
in class org.apache.hadoop.fs.FileSystem
public String getCanonicalServiceName()
getCanonicalServiceName
in interface org.apache.hadoop.security.token.DelegationTokenIssuer
getCanonicalServiceName
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 IOException
getFileBlockLocations
in class org.apache.hadoop.fs.FileSystem
IOException
public short getDefaultReplication()
getDefaultReplication
in class org.apache.hadoop.fs.FileSystem
public boolean setReplication(org.apache.hadoop.fs.Path path, short replication) throws IOException
setReplication
in class org.apache.hadoop.fs.FileSystem
IOException
public org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path path) throws IOException
getFileStatus
in class org.apache.hadoop.fs.FileSystem
IOException
public void setOwner(org.apache.hadoop.fs.Path path, String username, String groupname) throws IOException
setOwner
in class org.apache.hadoop.fs.FileSystem
path
- path to set owner or groupusername
- username to be setgroupname
- groupname to be setIOException
public void setPermission(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission) throws IOException
setPermission
in class org.apache.hadoop.fs.FileSystem
path
- path to set permissionpermission
- permission set to pathIOException
public abstract 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.FileSystem
FileSystem.createFileSystem(java.net.URI,
org.apache.hadoop.conf.Configuration)
public URI getUri()
getUri
in class org.apache.hadoop.fs.FileSystem
public org.apache.hadoop.fs.Path getWorkingDirectory()
getWorkingDirectory
in class org.apache.hadoop.fs.FileSystem
public void initialize(URI uri, org.apache.hadoop.conf.Configuration conf) throws IOException
initialize
in class org.apache.hadoop.fs.FileSystem
IOException
public void initialize(URI uri, org.apache.hadoop.conf.Configuration conf, @Nullable AlluxioConfiguration alluxioConfiguration) throws IOException
FileSystem
.uri
- file system Uriconf
- hadoop configurationalluxioConfiguration
- [optional] alluxio configurationIOException
@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 IOException
listStatus
in class org.apache.hadoop.fs.FileSystem
IOException
public boolean mkdirs(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission) throws IOException
mkdirs
in class org.apache.hadoop.fs.FileSystem
path
- path to createpermission
- permissions to grant the created folderIOException
public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path path, int bufferSize) throws IOException
open
in class org.apache.hadoop.fs.FileSystem
path
- the file name to openbufferSize
- stream buffer size in bytes, currently unusedFSDataInputStream
at the indicated path of a fileIOException
public boolean rename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) throws IOException
rename
in class org.apache.hadoop.fs.FileSystem
IOException
public void setWorkingDirectory(org.apache.hadoop.fs.Path path)
setWorkingDirectory
in class org.apache.hadoop.fs.FileSystem
protected abstract Map<String,Object> getConfigurationFromUri(URI uri, org.apache.hadoop.conf.Configuration conf)
uri
- an Alluxio Uri that may contain connection configurationprotected abstract void validateFsUri(URI fsUri) throws IOException, IllegalArgumentException
fsUri
- FS UriIOException
IllegalArgumentException
protected abstract String getFsScheme(URI fsUri)
fsUri
- file system base URIprotected abstract AlluxioURI getAlluxioPath(org.apache.hadoop.fs.Path path)
path
- the input pathCopyright © 2023. All Rights Reserved.