@PublicApi @NotThreadSafe public final class FileSystem extends org.apache.hadoop.fs.FileSystem
FileSystem
interface. Any program working with Hadoop HDFS can work with Alluxio transparently. Note that
the performance of using this API may not be as efficient as the performance of using the Alluxio
native API defined in FileSystem, which this API is built on top of.| Modifier and Type | Field and Description |
|---|---|
static String |
FIRST_COM_PATH |
protected FileSystem |
mFileSystem |
| Constructor and Description |
|---|
FileSystem()
Constructs a new
FileSystem. |
FileSystem(FileSystem fileSystem)
Constructs a new
FileSystem instance with a
specified FileSystem handler for tests. |
| Modifier and Type | Method and Description |
|---|---|
org.apache.hadoop.fs.FSDataOutputStream |
append(org.apache.hadoop.fs.Path path,
int bufferSize,
org.apache.hadoop.util.Progressable progress) |
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.
|
long |
getDefaultBlockSize() |
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.
|
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,
alluxio.conf.AlluxioConfiguration alluxioConfiguration)
Initialize the
FileSystem. |
protected boolean |
isZookeeperMode() |
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) |
addDelegationTokens, append, append, cancelDeleteOnExit, canonicalizeUri, 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, createNewFile, createNonRecursive, createNonRecursive, createSnapshot, createSnapshot, createSymlink, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAllStatistics, getBlockSize, getCanonicalServiceName, getCanonicalUri, getChildFileSystems, getContentSummary, getDefaultBlockSize, getDefaultPort, getDefaultReplication, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileChecksum, getFileLinkStatus, getFileSystemClass, getFSofPath, getHomeDirectory, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getUsed, globStatus, globStatus, isDirectory, isFile, isSymlinksEnabled, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, makeQualified, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, rename, renameSnapshot, resolveLink, resolvePath, setDefaultUri, setDefaultUri, setTimes, setVerifyChecksum, setWriteChecksum, startLocalOutput, supportsSymlinkspublic static final String FIRST_COM_PATH
protected FileSystem mFileSystem
public FileSystem()
FileSystem.public FileSystem(FileSystem fileSystem)
FileSystem instance with a
specified FileSystem handler for tests.fileSystem - handler to file systempublic String getScheme()
FileSystem. This was
introduced in Hadoop 2.x as a means to make loading new FileSystem
s simpler.FileSystem.createFileSystem(java.net.URI,
org.apache.hadoop.conf.Configuration)protected boolean isZookeeperMode()
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.FileSystemIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class org.apache.hadoop.fs.FileSystemIOExceptionpublic 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.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 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.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 progressIOExceptionsetPermission(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.FileSystempath - path to deleteIOExceptionpublic boolean delete(org.apache.hadoop.fs.Path path,
boolean recursive)
throws IOException
delete in class org.apache.hadoop.fs.FileSystempath - path to deleterecursive - if true, will attempt to delete all children of the pathIOExceptionpublic long getDefaultBlockSize()
getDefaultBlockSize 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.FileSystemIOExceptionpublic short getDefaultReplication()
getDefaultReplication in class org.apache.hadoop.fs.FileSystempublic boolean setReplication(org.apache.hadoop.fs.Path path,
short replication)
throws IOException
setReplication in class org.apache.hadoop.fs.FileSystemIOExceptionpublic org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path path)
throws IOException
getFileStatus in class org.apache.hadoop.fs.FileSystemIOExceptionpublic void setOwner(org.apache.hadoop.fs.Path path,
String username,
String groupname)
throws IOException
setOwner in class org.apache.hadoop.fs.FileSystempath - path to set owner or groupusername - username to be setgroupname - groupname to be setIOExceptionpublic void setPermission(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
throws IOException
setPermission in class org.apache.hadoop.fs.FileSystempath - path to set permissionpermission - permission set to pathIOExceptionpublic 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(URI uri, org.apache.hadoop.conf.Configuration conf) throws IOException
initialize in class org.apache.hadoop.fs.FileSystemIOExceptionpublic void initialize(URI uri, org.apache.hadoop.conf.Configuration conf, @Nullable alluxio.conf.AlluxioConfiguration alluxioConfiguration) throws IOException
FileSystem.uri - file system Uriconf - hadoop configurationalluxioConfiguration - [optional] alluxio configurationIOExceptionpublic org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path path)
throws IOException
listStatus in class org.apache.hadoop.fs.FileSystemIOExceptionpublic boolean mkdirs(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission permission)
throws IOException
mkdirs in class org.apache.hadoop.fs.FileSystempath - path to createpermission - permissions to grant the created folderIOExceptionpublic org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path path,
int bufferSize)
throws 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 fileIOExceptionpublic boolean rename(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst)
throws IOException
rename in class org.apache.hadoop.fs.FileSystemIOExceptionpublic void setWorkingDirectory(org.apache.hadoop.fs.Path path)
setWorkingDirectory in class org.apache.hadoop.fs.FileSystemCopyright © 2024. All Rights Reserved.