@PublicApi @ThreadSafe public class BaseFileSystem extends Object implements FileSystem
FileSystem interface. Developers can extend this class
instead of implementing the interface. This implementation reads and writes data through
FileInStream and FileOutStream. This class is thread safe.FileSystem.Cache, FileSystem.Factory, FileSystem.FileSystemKey| Modifier and Type | Field and Description |
|---|---|
protected AlluxioBlockStore |
mBlockStore |
protected boolean |
mCachingEnabled |
protected FileSystemContext |
mFsContext |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseFileSystem(FileSystemContext fsContext,
boolean cachingEnabled)
Constructs a new base file system.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shuts down the FileSystem.
|
static BaseFileSystem |
create(FileSystemContext context) |
static BaseFileSystem |
create(FileSystemContext context,
boolean cachingEnabled) |
void |
createDirectory(alluxio.AlluxioURI path)
Convenience method for
FileSystem.createDirectory(AlluxioURI, CreateDirectoryPOptions) with
default options. |
void |
createDirectory(alluxio.AlluxioURI path,
alluxio.grpc.CreateDirectoryPOptions options)
Creates a directory.
|
FileOutStream |
createFile(alluxio.AlluxioURI path)
Convenience method for
FileSystem.createFile(AlluxioURI, CreateFilePOptions) with default
options. |
FileOutStream |
createFile(alluxio.AlluxioURI path,
alluxio.grpc.CreateFilePOptions options)
Creates a file.
|
void |
delete(alluxio.AlluxioURI path)
Convenience method for
FileSystem.delete(AlluxioURI, DeletePOptions) with default options. |
void |
delete(alluxio.AlluxioURI path,
alluxio.grpc.DeletePOptions options)
Deletes a file or a directory.
|
boolean |
exists(alluxio.AlluxioURI path)
Convenience method for
FileSystem.exists(AlluxioURI, ExistsPOptions) with default options. |
boolean |
exists(alluxio.AlluxioURI path,
alluxio.grpc.ExistsPOptions options)
Checks whether a path exists in Alluxio space.
|
void |
free(alluxio.AlluxioURI path)
Convenience method for
FileSystem.free(AlluxioURI, FreePOptions) with default options. |
void |
free(alluxio.AlluxioURI path,
alluxio.grpc.FreePOptions options)
Evicts any data under the given path from Alluxio space, but does not delete the data from the
UFS.
|
List<alluxio.wire.BlockLocationInfo> |
getBlockLocations(alluxio.AlluxioURI path)
Builds a list of
BlockLocationInfo for the given file. |
alluxio.conf.AlluxioConfiguration |
getConf() |
Map<String,alluxio.wire.MountPointInfo> |
getMountTable()
Lists all mount points and their corresponding under storage addresses.
|
alluxio.client.file.URIStatus |
getStatus(alluxio.AlluxioURI path)
Convenience method for
FileSystem.getStatus(AlluxioURI, GetStatusPOptions) with default options. |
alluxio.client.file.URIStatus |
getStatus(alluxio.AlluxioURI path,
alluxio.grpc.GetStatusPOptions options)
Gets the
URIStatus object that represents the metadata of an Alluxio path. |
List<alluxio.wire.SyncPointInfo> |
getSyncPathList()
Lists all the actively synced paths.
|
boolean |
isClosed()
If there are operations currently running and close is called concurrently the behavior is
undefined.
|
List<alluxio.client.file.URIStatus> |
listStatus(alluxio.AlluxioURI path)
Convenience method for
FileSystem.listStatus(AlluxioURI, ListStatusPOptions) with default
options. |
List<alluxio.client.file.URIStatus> |
listStatus(alluxio.AlluxioURI path,
alluxio.grpc.ListStatusPOptions options)
If the path is a directory, returns the
URIStatus of all the direct entries in it. |
void |
mount(alluxio.AlluxioURI alluxioPath,
alluxio.AlluxioURI ufsPath)
Convenience method for
FileSystem.mount(AlluxioURI, AlluxioURI, MountPOptions) with default
options. |
void |
mount(alluxio.AlluxioURI alluxioPath,
alluxio.AlluxioURI ufsPath,
alluxio.grpc.MountPOptions options)
Mounts a UFS subtree to the given Alluxio path.
|
FileInStream |
openFile(alluxio.AlluxioURI path)
Convenience method for
FileSystem.openFile(AlluxioURI, OpenFilePOptions) with default options. |
FileInStream |
openFile(alluxio.AlluxioURI path,
alluxio.grpc.OpenFilePOptions options)
Opens a file for reading.
|
void |
persist(alluxio.AlluxioURI path)
Convenience method for
FileSystem.persist(AlluxioURI, ScheduleAsyncPersistencePOptions) which
uses the default ScheduleAsyncPersistencePOptions. |
void |
persist(alluxio.AlluxioURI path,
alluxio.grpc.ScheduleAsyncPersistencePOptions options)
Schedules the given path to be asynchronously persisted to the under file system.
|
void |
rename(alluxio.AlluxioURI src,
alluxio.AlluxioURI dst)
Convenience method for
FileSystem.rename(AlluxioURI, AlluxioURI, RenamePOptions) with default
options. |
void |
rename(alluxio.AlluxioURI src,
alluxio.AlluxioURI dst,
alluxio.grpc.RenamePOptions options)
Renames an existing Alluxio path to another Alluxio path in Alluxio.
|
void |
setAcl(alluxio.AlluxioURI path,
alluxio.grpc.SetAclAction action,
List<alluxio.security.authorization.AclEntry> entries)
Convenience method for
FileSystem.setAcl(AlluxioURI, SetAclAction, List, SetAclPOptions) with
default options. |
void |
setAcl(alluxio.AlluxioURI path,
alluxio.grpc.SetAclAction action,
List<alluxio.security.authorization.AclEntry> entries,
alluxio.grpc.SetAclPOptions options)
Sets the ACL for a path.
|
void |
setAttribute(alluxio.AlluxioURI path)
Convenience method for
FileSystem.setAttribute(AlluxioURI, SetAttributePOptions) with default
options. |
void |
setAttribute(alluxio.AlluxioURI path,
alluxio.grpc.SetAttributePOptions options)
Sets any number of a path's attributes, such as TTL and pin status.
|
void |
startSync(alluxio.AlluxioURI path)
Starts the active syncing process on an Alluxio path.
|
void |
stopSync(alluxio.AlluxioURI path)
Stops the active syncing process on an Alluxio path.
|
void |
unmount(alluxio.AlluxioURI path)
Convenience method for
FileSystem.unmount(AlluxioURI, UnmountPOptions) with default options. |
void |
unmount(alluxio.AlluxioURI path,
alluxio.grpc.UnmountPOptions options)
Unmounts a UFS subtree identified by the given Alluxio path.
|
void |
updateMount(alluxio.AlluxioURI alluxioPath,
alluxio.grpc.MountPOptions options)
Updates the options for an existing mount point.
|
protected final FileSystemContext mFsContext
protected final AlluxioBlockStore mBlockStore
protected final boolean mCachingEnabled
protected BaseFileSystem(FileSystemContext fsContext, boolean cachingEnabled)
fsContext - file system contextpublic static BaseFileSystem create(FileSystemContext context)
context - the FileSystemContext to use for client operationsBaseFileSystempublic static BaseFileSystem create(FileSystemContext context, boolean cachingEnabled)
context - the FileSystemContext to use for client operationscachingEnabled - whether or not this FileSystem should remove itself from the
Factory cache when closedBaseFileSystempublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
FileSystemisClosed in interface FileSystempublic void createDirectory(alluxio.AlluxioURI path)
throws alluxio.exception.FileAlreadyExistsException,
alluxio.exception.InvalidPathException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.createDirectory(AlluxioURI, CreateDirectoryPOptions) with
default options.createDirectory in interface FileSystempath - the path of the directory to create in Alluxio spacealluxio.exception.FileAlreadyExistsException - if there is already a file or directory at the given pathalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic void createDirectory(alluxio.AlluxioURI path,
alluxio.grpc.CreateDirectoryPOptions options)
throws alluxio.exception.FileAlreadyExistsException,
alluxio.exception.InvalidPathException,
IOException,
alluxio.exception.AlluxioException
FileSystemcreateDirectory in interface FileSystempath - the path of the directory to create in Alluxio spaceoptions - options to associate with this operationalluxio.exception.FileAlreadyExistsException - if there is already a file or directory at the given pathalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic FileOutStream createFile(alluxio.AlluxioURI path) throws alluxio.exception.FileAlreadyExistsException, alluxio.exception.InvalidPathException, IOException, alluxio.exception.AlluxioException
FileSystemFileSystem.createFile(AlluxioURI, CreateFilePOptions) with default
options.createFile in interface FileSystempath - the path of the file to create in Alluxio spaceFileOutStream which will write data to the newly created filealluxio.exception.FileAlreadyExistsException - if there is already a file at the given pathalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic FileOutStream createFile(alluxio.AlluxioURI path, alluxio.grpc.CreateFilePOptions options) throws alluxio.exception.FileAlreadyExistsException, alluxio.exception.InvalidPathException, IOException, alluxio.exception.AlluxioException
FileSystemcreateFile in interface FileSystempath - the path of the file to create in Alluxio spaceoptions - options to associate with this operationFileOutStream which will write data to the newly created filealluxio.exception.FileAlreadyExistsException - if there is already a file at the given pathalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic void delete(alluxio.AlluxioURI path)
throws alluxio.exception.DirectoryNotEmptyException,
alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.delete(AlluxioURI, DeletePOptions) with default options.delete in interface FileSystempath - the path to delete in Alluxio spacealluxio.exception.DirectoryNotEmptyException - if recursive is false and the path is a nonempty directoryalluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void delete(alluxio.AlluxioURI path,
alluxio.grpc.DeletePOptions options)
throws alluxio.exception.DirectoryNotEmptyException,
alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemdelete in interface FileSystempath - the path to delete in Alluxio spaceoptions - options to associate with this operationalluxio.exception.DirectoryNotEmptyException - if recursive is false and the path is a nonempty directoryalluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic boolean exists(alluxio.AlluxioURI path)
throws alluxio.exception.InvalidPathException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.exists(AlluxioURI, ExistsPOptions) with default options.exists in interface FileSystempath - the path in questionalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic boolean exists(alluxio.AlluxioURI path,
alluxio.grpc.ExistsPOptions options)
throws IOException,
alluxio.exception.AlluxioException
FileSystemexists in interface FileSystempath - the path in questionoptions - options to associate with this operationalluxio.exception.InvalidPathException - if the path is invalidIOExceptionalluxio.exception.AlluxioExceptionpublic void free(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.free(AlluxioURI, FreePOptions) with default options.free in interface FileSystempath - the path to free in Alluxio spacealluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void free(alluxio.AlluxioURI path,
alluxio.grpc.FreePOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemfree in interface FileSystempath - the path to free in Alluxio spaceoptions - options to associate with this operationalluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic List<alluxio.wire.BlockLocationInfo> getBlockLocations(alluxio.AlluxioURI path) throws IOException, alluxio.exception.AlluxioException
FileSystemBlockLocationInfo for the given file. Each list item contains a list
of WorkerNetAddress which allows a user to determine the physical location of a block
of the given file stored within Alluxio. In the case where data is stored in a UFS, but not in
Alluxio this function will only include a WorkerNetAddress if the block stored in the
UFS is co-located with an Alluxio worker.
However if there are no co-located Alluxio workers for the block, then the behavior is
controlled by the PropertyKey.USER_UFS_BLOCK_LOCATION_ALL_FALLBACK_ENABLED . If
this property is set to true then every Alluxio worker will be returned.
Blocks which are stored in the UFS and are *not* co-located with any Alluxio worker will return
an empty list. If the file block is within Alluxio *and* the UFS then this will only return
Alluxio workers which currently store the block.getBlockLocations in interface FileSystempath - the path to get block info foralluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic alluxio.conf.AlluxioConfiguration getConf()
getConf in interface FileSystempublic alluxio.client.file.URIStatus getStatus(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.getStatus(AlluxioURI, GetStatusPOptions) with default options.getStatus in interface FileSystempath - the path to obtain information aboutURIStatus of the filealluxio.exception.FileDoesNotExistException - if the path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic alluxio.client.file.URIStatus getStatus(alluxio.AlluxioURI path,
alluxio.grpc.GetStatusPOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemURIStatus object that represents the metadata of an Alluxio path.getStatus in interface FileSystempath - the path to obtain information aboutoptions - options to associate with this operationURIStatus of the filealluxio.exception.FileDoesNotExistException - if the path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic List<alluxio.client.file.URIStatus> listStatus(alluxio.AlluxioURI path) throws alluxio.exception.FileDoesNotExistException, IOException, alluxio.exception.AlluxioException
FileSystemFileSystem.listStatus(AlluxioURI, ListStatusPOptions) with default
options.listStatus in interface FileSystempath - the path to list information aboutURIStatuss containing information about the files and directories
which are children of the given pathalluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic List<alluxio.client.file.URIStatus> listStatus(alluxio.AlluxioURI path, alluxio.grpc.ListStatusPOptions options) throws alluxio.exception.FileDoesNotExistException, IOException, alluxio.exception.AlluxioException
FileSystemURIStatus of all the direct entries in it.
Otherwise returns a list with a single URIStatus element for the file.listStatus in interface FileSystempath - the path to list information aboutoptions - options to associate with this operationURIStatuss containing information about the files and directories
which are children of the given pathalluxio.exception.FileDoesNotExistException - if the given path does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void mount(alluxio.AlluxioURI alluxioPath,
alluxio.AlluxioURI ufsPath)
throws IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.mount(AlluxioURI, AlluxioURI, MountPOptions) with default
options.mount in interface FileSystemalluxioPath - an Alluxio path to mount the data toufsPath - a UFS path to mount the data fromIOExceptionalluxio.exception.AlluxioExceptionpublic void mount(alluxio.AlluxioURI alluxioPath,
alluxio.AlluxioURI ufsPath,
alluxio.grpc.MountPOptions options)
throws IOException,
alluxio.exception.AlluxioException
FileSystemAlluxioException will be thrown.
This method does not transfer any data or metadata from the UFS. It simply establishes the
connection between the given Alluxio path and UFS path.mount in interface FileSystemalluxioPath - an Alluxio path to mount the data toufsPath - a UFS path to mount the data fromoptions - options to associate with this operationIOExceptionalluxio.exception.AlluxioExceptionpublic void updateMount(alluxio.AlluxioURI alluxioPath,
alluxio.grpc.MountPOptions options)
throws IOException,
alluxio.exception.AlluxioException
FileSystemupdateMount in interface FileSystemalluxioPath - the Alluxio path of the mount pointoptions - options for this mount pointIOExceptionalluxio.exception.AlluxioExceptionpublic Map<String,alluxio.wire.MountPointInfo> getMountTable() throws IOException, alluxio.exception.AlluxioException
FileSystemgetMountTable in interface FileSystemMountPointInfoIOExceptionalluxio.exception.AlluxioExceptionpublic List<alluxio.wire.SyncPointInfo> getSyncPathList() throws IOException, alluxio.exception.AlluxioException
FileSystemgetSyncPathList in interface FileSystemIOExceptionalluxio.exception.AlluxioExceptionpublic void persist(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.persist(AlluxioURI, ScheduleAsyncPersistencePOptions) which
uses the default ScheduleAsyncPersistencePOptions.persist in interface FileSystempath - the uri of the file to persistalluxio.exception.FileDoesNotExistExceptionIOExceptionalluxio.exception.AlluxioExceptionpublic void persist(alluxio.AlluxioURI path,
alluxio.grpc.ScheduleAsyncPersistencePOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystemUtils#persistAndWait(FileSystem, AlluxioURI).persist in interface FileSystempath - the uri of the file to persistoptions - the options to use when submitting persist the pathalluxio.exception.FileDoesNotExistExceptionIOExceptionalluxio.exception.AlluxioExceptionpublic FileInStream openFile(alluxio.AlluxioURI path) throws alluxio.exception.FileDoesNotExistException, IOException, alluxio.exception.AlluxioException
FileSystemFileSystem.openFile(AlluxioURI, OpenFilePOptions) with default options.openFile in interface FileSystempath - the file to read fromFileInStream for the given pathalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic FileInStream openFile(alluxio.AlluxioURI path, alluxio.grpc.OpenFilePOptions options) throws alluxio.exception.FileDoesNotExistException, IOException, alluxio.exception.AlluxioException
FileSystemopenFile in interface FileSystempath - the file to read fromoptions - options to associate with this operationFileInStream for the given pathalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void rename(alluxio.AlluxioURI src,
alluxio.AlluxioURI dst)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.rename(AlluxioURI, AlluxioURI, RenamePOptions) with default
options.rename in interface FileSystemsrc - the path of the source, this must already existdst - the path of the destination, this path should not existalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void rename(alluxio.AlluxioURI src,
alluxio.AlluxioURI dst,
alluxio.grpc.RenamePOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemrename in interface FileSystemsrc - the path of the source, this must already existdst - the path of the destination, this path should not existoptions - options to associate with this operationalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void setAcl(alluxio.AlluxioURI path,
alluxio.grpc.SetAclAction action,
List<alluxio.security.authorization.AclEntry> entries)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.setAcl(AlluxioURI, SetAclAction, List, SetAclPOptions) with
default options.setAcl in interface FileSystempath - the path to set the ACL foraction - the set action to performentries - the ACL entriesalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void setAcl(alluxio.AlluxioURI path,
alluxio.grpc.SetAclAction action,
List<alluxio.security.authorization.AclEntry> entries,
alluxio.grpc.SetAclPOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemsetAcl in interface FileSystempath - the path to set the ACL foraction - the set action to performentries - the ACL entriesoptions - options to associate with this operationalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void setAttribute(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.setAttribute(AlluxioURI, SetAttributePOptions) with default
options.setAttribute in interface FileSystempath - the path to set attributes foralluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void setAttribute(alluxio.AlluxioURI path,
alluxio.grpc.SetAttributePOptions options)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
FileSystemsetAttribute in interface FileSystempath - the path to set attributes foroptions - options to associate with this operationalluxio.exception.FileDoesNotExistException - if the given file does not existIOExceptionalluxio.exception.AlluxioExceptionpublic void startSync(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
startSync in interface FileSystempath - the path to syncalluxio.exception.FileDoesNotExistExceptionIOExceptionalluxio.exception.AlluxioExceptionpublic void stopSync(alluxio.AlluxioURI path)
throws alluxio.exception.FileDoesNotExistException,
IOException,
alluxio.exception.AlluxioException
stopSync in interface FileSystempath - the path to stop syncingalluxio.exception.FileDoesNotExistExceptionIOExceptionalluxio.exception.AlluxioExceptionpublic void unmount(alluxio.AlluxioURI path)
throws IOException,
alluxio.exception.AlluxioException
FileSystemFileSystem.unmount(AlluxioURI, UnmountPOptions) with default options.unmount in interface FileSystempath - an Alluxio path, this must be a mount pointIOExceptionalluxio.exception.AlluxioExceptionpublic void unmount(alluxio.AlluxioURI path,
alluxio.grpc.UnmountPOptions options)
throws IOException,
alluxio.exception.AlluxioException
FileSystemunmount in interface FileSystempath - an Alluxio path, this must be a mount pointoptions - options to associate with this operationIOExceptionalluxio.exception.AlluxioExceptionCopyright © 2024. All Rights Reserved.