@InterfaceAudience.Public @InterfaceStability.Stable public abstract class AbstractFileSystem extends Object implements org.apache.hadoop.fs.PathCapabilities
FileContext
.
Pathnames passed to AbstractFileSystem can be fully qualified URI that
matches the "this" file system (ie same scheme and authority)
or a Slash-relative name that is assumed to be relative
to the root of the "this" file system .Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.fs.FileSystem.Statistics |
statistics
The statistics for this file system.
|
Constructor and Description |
---|
AbstractFileSystem(URI uri,
String supportedScheme,
boolean authorityNeeded,
int defaultPort)
Constructor to be called by subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
checkPath(Path path)
Check that a Path belongs to this FileSystem.
|
void |
checkScheme(URI uri,
String supportedScheme)
Check that the Uri's scheme matches
|
static void |
clearStatistics() |
FSDataOutputStream |
create(Path f,
EnumSet<CreateFlag> createFlag,
org.apache.hadoop.fs.Options.CreateOpts... opts)
The specification of this method matches that of
FileContext.create(Path, EnumSet, Options.CreateOpts...) except
that the Path f must be fully qualified and the permission is absolute
(i.e. |
static AbstractFileSystem |
createFileSystem(URI uri,
Configuration conf)
Create a file system instance for the specified uri using the conf.
|
abstract FSDataOutputStream |
createInternal(Path f,
EnumSet<CreateFlag> flag,
FsPermission absolutePermission,
int bufferSize,
short replication,
long blockSize,
Progressable progress,
org.apache.hadoop.fs.Options.ChecksumOpt checksumOpt,
boolean createParent)
The specification of this method matches that of
create(Path, EnumSet, Options.CreateOpts...) except that the opts
have been declared explicitly. |
Path |
createSnapshot(Path path,
String snapshotName)
The specification of this method matches that of
FileContext.createSnapshot(Path, String) . |
void |
createSymlink(Path target,
Path link,
boolean createParent)
The specification of this method matches that of
FileContext.createSymlink(Path, Path, boolean) ; |
abstract boolean |
delete(Path f,
boolean recursive)
The specification of this method matches that of
FileContext.delete(Path, boolean) except that Path f must be for
this file system. |
void |
deleteSnapshot(Path snapshotDir,
String snapshotName)
The specification of this method matches that of
FileContext.deleteSnapshot(Path, String) . |
boolean |
equals(Object other) |
static AbstractFileSystem |
get(URI uri,
Configuration conf)
The main factory method for creating a file system.
|
AclStatus |
getAclStatus(Path path)
Gets the ACLs of files and directories.
|
protected static Map<URI,org.apache.hadoop.fs.FileSystem.Statistics> |
getAllStatistics() |
Collection<? extends BlockStoragePolicySpi> |
getAllStoragePolicies()
Retrieve all the storage policies supported by this file system.
|
String |
getCanonicalServiceName()
Get a canonical name for this file system.
|
abstract BlockLocation[] |
getFileBlockLocations(Path f,
long start,
long len)
The specification of this method matches that of
FileContext.getFileBlockLocations(Path, long, long) except that
Path f must be for this file system. |
abstract FileChecksum |
getFileChecksum(Path f)
The specification of this method matches that of
FileContext.getFileChecksum(Path) except that Path f must be for
this file system. |
FileStatus |
getFileLinkStatus(Path f)
The specification of this method matches that of
FileContext.getFileLinkStatus(Path)
except that an UnresolvedLinkException may be thrown if a symlink is
encountered in the path leading up to the final path component. |
abstract FileStatus |
getFileStatus(Path f)
The specification of this method matches that of
FileContext.getFileStatus(Path)
except that an UnresolvedLinkException may be thrown if a symlink is
encountered in the path. |
abstract FsStatus |
getFsStatus()
The specification of this method matches that of
FileContext.getFsStatus(Path) . |
FsStatus |
getFsStatus(Path f)
The specification of this method matches that of
FileContext.getFsStatus(Path) except that Path f must be for this
file system. |
Path |
getHomeDirectory()
Return the current user's home directory in this file system.
|
Path |
getInitialWorkingDirectory()
Some file systems like LocalFileSystem have an initial workingDir
that is used as the starting workingDir.
|
Path |
getLinkTarget(Path f)
Partially resolves the path.
|
abstract FsServerDefaults |
getServerDefaults()
Deprecated.
use
getServerDefaults(Path) instead |
FsServerDefaults |
getServerDefaults(Path f)
Return a set of server default configuration values based on path.
|
org.apache.hadoop.fs.FileSystem.Statistics |
getStatistics() |
protected static org.apache.hadoop.fs.FileSystem.Statistics |
getStatistics(URI uri)
Get the statistics for a particular file system.
|
BlockStoragePolicySpi |
getStoragePolicy(Path src)
Retrieve the storage policy for a given file or directory.
|
URI |
getUri()
Returns a URI whose scheme and authority identify this FileSystem.
|
abstract int |
getUriDefaultPort()
The default port of this file system.
|
String |
getUriPath(Path p)
Get the path-part of a pathname.
|
byte[] |
getXAttr(Path path,
String name)
Get an xattr for a file or directory.
|
Map<String,byte[]> |
getXAttrs(Path path)
Get all of the xattrs for a file or directory.
|
Map<String,byte[]> |
getXAttrs(Path path,
List<String> names)
Get all of the xattrs for a file or directory.
|
int |
hashCode() |
boolean |
hasPathCapability(Path path,
String capability)
Probe for a specific capability under the given path.
|
boolean |
isValidName(String src)
Returns true if the specified string is considered valid in the path part
of a URI by this file system.
|
org.apache.hadoop.fs.RemoteIterator<Path> |
listCorruptFileBlocks(Path path) |
org.apache.hadoop.fs.RemoteIterator<LocatedFileStatus> |
listLocatedStatus(Path f)
The specification of this method matches that of
FileContext.listLocatedStatus(Path) except that Path f
must be for this file system. |
abstract FileStatus[] |
listStatus(Path f)
The specification of this method matches that of
FileContext.Util.listStatus(Path) except that Path f must be
for this file system. |
org.apache.hadoop.fs.RemoteIterator<FileStatus> |
listStatusIterator(Path f)
The specification of this method matches that of
FileContext.listStatus(Path) except that Path f must be for this
file system. |
List<String> |
listXAttrs(Path path)
Get all of the xattr names for a file or directory.
|
Path |
makeQualified(Path path)
Make the path fully qualified to this file system
|
abstract void |
mkdir(Path dir,
FsPermission permission,
boolean createParent)
The specification of this method matches that of
FileContext.mkdir(Path, FsPermission, boolean) except that the Path
f must be fully qualified and the permission is absolute (i.e. |
void |
modifyAclEntries(Path path,
List<AclEntry> aclSpec)
Modifies ACL entries of files and directories.
|
FSDataInputStream |
open(Path f)
The specification of this method matches that of
FileContext.open(Path) except that Path f must be for this
file system. |
abstract FSDataInputStream |
open(Path f,
int bufferSize)
The specification of this method matches that of
FileContext.open(Path, int) except that Path f must be for this
file system. |
CompletableFuture<FSDataInputStream> |
openFileWithOptions(Path path,
org.apache.hadoop.fs.impl.OpenFileParameters parameters)
Open a file with the given set of options.
|
static void |
printStatistics()
Prints statistics for all file systems.
|
void |
removeAcl(Path path)
Removes all but the base ACL entries of files and directories.
|
void |
removeAclEntries(Path path,
List<AclEntry> aclSpec)
Removes ACL entries from files and directories.
|
void |
removeDefaultAcl(Path path)
Removes all default ACL entries from files and directories.
|
void |
removeXAttr(Path path,
String name)
Remove an xattr of a file or directory.
|
void |
rename(Path src,
Path dst,
org.apache.hadoop.fs.Options.Rename... options)
The specification of this method matches that of
FileContext.rename(Path, Path, Options.Rename...) except that Path
f must be for this file system. |
abstract void |
renameInternal(Path src,
Path dst)
The specification of this method matches that of
FileContext.rename(Path, Path, Options.Rename...) except that Path
f must be for this file system and NO OVERWRITE is performed. |
void |
renameInternal(Path src,
Path dst,
boolean overwrite)
The specification of this method matches that of
FileContext.rename(Path, Path, Options.Rename...) except that Path
f must be for this file system. |
void |
renameSnapshot(Path path,
String snapshotOldName,
String snapshotNewName)
The specification of this method matches that of
FileContext.renameSnapshot(Path, String, String) . |
Path |
resolvePath(Path p)
Return the fully-qualified path of path f resolving the path
through any internal symlinks or mount point
|
void |
satisfyStoragePolicy(Path path)
Set the source path to satisfy storage policy.
|
void |
setAcl(Path path,
List<AclEntry> aclSpec)
Fully replaces ACL of files and directories, discarding all existing
entries.
|
abstract void |
setOwner(Path f,
String username,
String groupname)
The specification of this method matches that of
FileContext.setOwner(Path, String, String) except that Path f must
be for this file system. |
abstract void |
setPermission(Path f,
FsPermission permission)
The specification of this method matches that of
FileContext.setPermission(Path, FsPermission) except that Path f
must be for this file system. |
abstract boolean |
setReplication(Path f,
short replication)
The specification of this method matches that of
FileContext.setReplication(Path, short) except that Path f must be
for this file system. |
void |
setStoragePolicy(Path path,
String policyName)
Set the storage policy for a given file or directory.
|
abstract void |
setTimes(Path f,
long mtime,
long atime)
The specification of this method matches that of
FileContext.setTimes(Path, long, long) except that Path f must be
for this file system. |
abstract void |
setVerifyChecksum(boolean verifyChecksum)
The specification of this method matches that of
FileContext.setVerifyChecksum(boolean, Path) except that Path f
must be for this file system. |
void |
setXAttr(Path path,
String name,
byte[] value)
Set an xattr of a file or directory.
|
void |
setXAttr(Path path,
String name,
byte[] value,
EnumSet<XAttrSetFlag> flag)
Set an xattr of a file or directory.
|
boolean |
supportsSymlinks()
Returns true if the file system supports symlinks, false otherwise.
|
boolean |
truncate(Path f,
long newLength)
The specification of this method matches that of
FileContext.truncate(Path, long) except that Path f must be for
this file system. |
void |
unsetStoragePolicy(Path src)
Unset the storage policy set for a given file or directory.
|
protected org.apache.hadoop.fs.FileSystem.Statistics statistics
public AbstractFileSystem(URI uri, String supportedScheme, boolean authorityNeeded, int defaultPort) throws URISyntaxException
uri
- for this file system.supportedScheme
- the scheme supported by the implementorauthorityNeeded
- if true then theURI must have authority, if false
then the URI must have null authority.URISyntaxException
- uri
has syntax errorpublic org.apache.hadoop.fs.FileSystem.Statistics getStatistics()
public boolean isValidName(String src)
src
- String source filename to check, path part of the URIpublic static AbstractFileSystem createFileSystem(URI uri, Configuration conf) throws UnsupportedFileSystemException
uri
- URI of the file systemconf
- Configuration for the file systemUnsupportedFileSystemException
- file system for uri
is
not foundprotected static org.apache.hadoop.fs.FileSystem.Statistics getStatistics(URI uri)
uri
- used as key to lookup STATISTICS_TABLE. Only scheme and authority
part of the uri are used.public static void clearStatistics()
public static void printStatistics()
protected static Map<URI,org.apache.hadoop.fs.FileSystem.Statistics> getAllStatistics()
public static AbstractFileSystem get(URI uri, Configuration conf) throws UnsupportedFileSystemException
uri
determines a configuration property name,
fs.AbstractFileSystem.scheme.impl whose value names the
AbstractFileSystem class.
The entire URI and conf is passed to the AbstractFileSystem factory method.uri
- for the file system to be created.conf
- which is passed to the file system impl.UnsupportedFileSystemException
- if the file system for
uri
is not supported.public void checkScheme(URI uri, String supportedScheme)
uri
- supportedScheme
- public abstract int getUriDefaultPort()
public URI getUri()
public void checkPath(Path path)
InvalidPathException
- if the path is invalidpublic String getUriPath(Path p)
p
- pathpublic Path makeQualified(Path path)
path
- public Path getInitialWorkingDirectory()
public Path getHomeDirectory()
@Deprecated public abstract FsServerDefaults getServerDefaults() throws IOException
getServerDefaults(Path)
insteadIOException
- an I/O error occurredpublic FsServerDefaults getServerDefaults(Path f) throws IOException
f
- path to fetch server defaultsIOException
- an I/O error occurredpublic Path resolvePath(Path p) throws FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, AccessControlException, IOException
p
- path to be resolvedFileNotFoundException
AccessControlException
IOException
org.apache.hadoop.fs.UnresolvedLinkException
- if symbolic link on path cannot be
resolved internallypublic final FSDataOutputStream create(Path f, EnumSet<CreateFlag> createFlag, org.apache.hadoop.fs.Options.CreateOpts... opts) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, UnsupportedFileSystemException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.create(Path, EnumSet, Options.CreateOpts...)
except
that the Path f must be fully qualified and the permission is absolute
(i.e. umask has been applied).AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
UnsupportedFileSystemException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FSDataOutputStream createInternal(Path f, EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize, short replication, long blockSize, Progressable progress, org.apache.hadoop.fs.Options.ChecksumOpt checksumOpt, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, UnsupportedFileSystemException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
create(Path, EnumSet, Options.CreateOpts...)
except that the opts
have been declared explicitly.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
UnsupportedFileSystemException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract void mkdir(Path dir, FsPermission permission, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.mkdir(Path, FsPermission, boolean)
except that the Path
f must be fully qualified and the permission is absolute (i.e.
umask has been applied).AccessControlException
FileAlreadyExistsException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract boolean delete(Path f, boolean recursive) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.delete(Path, boolean)
except that Path f must be for
this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public FSDataInputStream open(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.open(Path)
except that Path f must be for this
file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FSDataInputStream open(Path f, int bufferSize) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.open(Path, int)
except that Path f must be for this
file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public boolean truncate(Path f, long newLength) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.truncate(Path, long)
except that Path f must be for
this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract boolean setReplication(Path f, short replication) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.setReplication(Path, short)
except that Path f must be
for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public final void rename(Path src, Path dst, org.apache.hadoop.fs.Options.Rename... options) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.rename(Path, Path, Options.Rename...)
except that Path
f must be for this file system.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract void renameInternal(Path src, Path dst) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.rename(Path, Path, Options.Rename...)
except that Path
f must be for this file system and NO OVERWRITE is performed.
File systems that do not have a built in overwrite need implement only this
method and can take advantage of the default impl of the other
renameInternal(Path, Path, boolean)
AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public void renameInternal(Path src, Path dst, boolean overwrite) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.rename(Path, Path, Options.Rename...)
except that Path
f must be for this file system.AccessControlException
FileAlreadyExistsException
FileNotFoundException
ParentNotDirectoryException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public boolean supportsSymlinks()
public void createSymlink(Path target, Path link, boolean createParent) throws IOException, org.apache.hadoop.fs.UnresolvedLinkException
FileContext.createSymlink(Path, Path, boolean)
;IOException
org.apache.hadoop.fs.UnresolvedLinkException
public Path getLinkTarget(Path f) throws IOException
FSLinkResolver
, and differs from the similarly named method
FileContext.getLinkTarget(Path)
.IOException
- subclass implementations may throw IOExceptionpublic abstract void setPermission(Path f, FsPermission permission) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.setPermission(Path, FsPermission)
except that Path f
must be for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract void setOwner(Path f, String username, String groupname) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.setOwner(Path, String, String)
except that Path f must
be for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract void setTimes(Path f, long mtime, long atime) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.setTimes(Path, long, long)
except that Path f must be
for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FileChecksum getFileChecksum(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.getFileChecksum(Path)
except that Path f must be for
this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FileStatus getFileStatus(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.getFileStatus(Path)
except that an UnresolvedLinkException may be thrown if a symlink is
encountered in the path.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public FileStatus getFileLinkStatus(Path f) throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException
FileContext.getFileLinkStatus(Path)
except that an UnresolvedLinkException may be thrown if a symlink is
encountered in the path leading up to the final path component.
If the file system does not support symlinks then the behavior is
equivalent to getFileStatus(Path)
.public abstract BlockLocation[] getFileBlockLocations(Path f, long start, long len) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.getFileBlockLocations(Path, long, long)
except that
Path f must be for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public FsStatus getFsStatus(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.getFsStatus(Path)
except that Path f must be for this
file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FsStatus getFsStatus() throws AccessControlException, FileNotFoundException, IOException
FileContext.getFsStatus(Path)
.public org.apache.hadoop.fs.RemoteIterator<FileStatus> listStatusIterator(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.listStatus(Path)
except that Path f must be for this
file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public org.apache.hadoop.fs.RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.listLocatedStatus(Path)
except that Path f
must be for this file system.
In HDFS implementation, the BlockLocation of returned LocatedFileStatus
will have different formats for replicated and erasure coded file. Please
refer to FileSystem.getFileBlockLocations(FileStatus, long, long)
for more details.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public abstract FileStatus[] listStatus(Path f) throws AccessControlException, FileNotFoundException, org.apache.hadoop.fs.UnresolvedLinkException, IOException
FileContext.Util.listStatus(Path)
except that Path f must be
for this file system.AccessControlException
FileNotFoundException
org.apache.hadoop.fs.UnresolvedLinkException
IOException
public org.apache.hadoop.fs.RemoteIterator<Path> listCorruptFileBlocks(Path path) throws IOException
IOException
public abstract void setVerifyChecksum(boolean verifyChecksum) throws AccessControlException, IOException
FileContext.setVerifyChecksum(boolean, Path)
except that Path f
must be for this file system.AccessControlException
IOException
public String getCanonicalServiceName()
public void modifyAclEntries(Path path, List<AclEntry> aclSpec) throws IOException
path
- Path to modifyaclSpec
- List<AclEntry> describing modificationsIOException
- if an ACL could not be modifiedpublic void removeAclEntries(Path path, List<AclEntry> aclSpec) throws IOException
path
- Path to modifyaclSpec
- List<AclEntry> describing entries to removeIOException
- if an ACL could not be modifiedpublic void removeDefaultAcl(Path path) throws IOException
path
- Path to modifyIOException
- if an ACL could not be modifiedpublic void removeAcl(Path path) throws IOException
path
- Path to modifyIOException
- if an ACL could not be removedpublic void setAcl(Path path, List<AclEntry> aclSpec) throws IOException
path
- Path to modifyaclSpec
- List<AclEntry> describing modifications, must
include entries for user, group, and others for compatibility with
permission bits.IOException
- if an ACL could not be modifiedpublic AclStatus getAclStatus(Path path) throws IOException
path
- Path to getIOException
- if an ACL could not be readpublic void setXAttr(Path path, String name, byte[] value) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to modifyname
- xattr name.value
- xattr value.IOException
public void setXAttr(Path path, String name, byte[] value, EnumSet<XAttrSetFlag> flag) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to modifyname
- xattr name.value
- xattr value.flag
- xattr set flagIOException
public byte[] getXAttr(Path path, String name) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to get extended attributename
- xattr name.IOException
public Map<String,byte[]> getXAttrs(Path path) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to get extended attributesIOException
public Map<String,byte[]> getXAttrs(Path path, List<String> names) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to get extended attributesnames
- XAttr names.IOException
public List<String> listXAttrs(Path path) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to get extended attributesIOException
public void removeXAttr(Path path, String name) throws IOException
Refer to the HDFS extended attributes user documentation for details.
path
- Path to remove extended attributename
- xattr nameIOException
public Path createSnapshot(Path path, String snapshotName) throws IOException
FileContext.createSnapshot(Path, String)
.IOException
public void renameSnapshot(Path path, String snapshotOldName, String snapshotNewName) throws IOException
FileContext.renameSnapshot(Path, String, String)
.IOException
public void deleteSnapshot(Path snapshotDir, String snapshotName) throws IOException
FileContext.deleteSnapshot(Path, String)
.IOException
public void satisfyStoragePolicy(Path path) throws IOException
path
- The source path referring to either a directory or a file.IOException
public void setStoragePolicy(Path path, String policyName) throws IOException
path
- file or directory path.policyName
- the name of the target storage policy. The list
of supported Storage policies can be retrieved
via getAllStoragePolicies()
.IOException
public void unsetStoragePolicy(Path src) throws IOException
src
- file or directory path.IOException
public BlockStoragePolicySpi getStoragePolicy(Path src) throws IOException
src
- file or directory path.IOException
public Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies() throws IOException
IOException
public CompletableFuture<FSDataInputStream> openFileWithOptions(Path path, org.apache.hadoop.fs.impl.OpenFileParameters parameters) throws IOException
open(Path, int)
in this call;
the actual outcome is in the returned CompletableFuture
.
This avoids having to create some thread pool, while still
setting up the expectation that the get()
call
is needed to evaluate the result.path
- path to the fileparameters
- open file parameters from the builder.IOException
- failure to resolve the link.IllegalArgumentException
- unknown mandatory keypublic boolean hasPathCapability(Path path, String capability) throws IOException
org.apache.hadoop.fs.PathCapabilities
true
, this instance is explicitly
declaring that the capability is available.
If the function returns false
, it can mean one of:
Implementors: PathCapabilitiesSupport
can be used to help implement this method.
hasPathCapability
in interface org.apache.hadoop.fs.PathCapabilities
path
- path to query the capability of.capability
- non-null, non-empty string to query the path for support.IOException
- this should not be raised, except on problems
resolving paths or relaying the call.Copyright © 2020 Apache Software Foundation. All rights reserved.