public class AlluxioHdfsFileSystem extends Object implements FileSystem
FileSystem.Factory
Constructor and Description |
---|
AlluxioHdfsFileSystem(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
createDirectory(AlluxioURI alluxioURI,
CreateDirectoryPOptions options)
Creates a directory.
|
FileOutStream |
createFile(AlluxioURI alluxioURI,
CreateFilePOptions options)
Creates a file.
|
void |
delete(AlluxioURI alluxioURI,
DeletePOptions options)
Deletes a file or a directory.
|
boolean |
exists(AlluxioURI alluxioURI,
ExistsPOptions options)
Checks whether a path exists in Alluxio space.
|
void |
free(AlluxioURI alluxioURI,
FreePOptions options)
Evicts any data under the given path from Alluxio space, but does not delete the data from the
UFS.
|
List<BlockLocationInfo> |
getBlockLocations(AlluxioURI alluxioURI)
Builds a list of
BlockLocationInfo for the given file. |
AlluxioConfiguration |
getConf() |
Map<String,MountPointInfo> |
getMountTable()
Lists all mount points and their corresponding under storage addresses.
|
URIStatus |
getStatus(AlluxioURI alluxioURI,
GetStatusPOptions options)
Gets the
URIStatus object that represents the metadata of an Alluxio path. |
List<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<URIStatus> |
listStatus(AlluxioURI alluxioURI,
ListStatusPOptions options)
If the path is a directory, returns the
URIStatus of all the direct entries in it. |
void |
mount(AlluxioURI alluxioURI1,
AlluxioURI alluxioURI2,
MountPOptions options)
Mounts a UFS subtree to the given Alluxio path.
|
FileInStream |
openFile(AlluxioURI alluxioURI,
OpenFilePOptions options)
Opens a file for reading.
|
FileInStream |
openFile(URIStatus uriStatus,
OpenFilePOptions options)
Opens a file for reading.
|
void |
persist(AlluxioURI alluxioURI,
ScheduleAsyncPersistencePOptions options)
Schedules the given path to be asynchronously persisted to the under file system.
|
void |
rename(AlluxioURI source,
AlluxioURI destination,
RenamePOptions options)
Renames an existing Alluxio path to another Alluxio path in Alluxio.
|
AlluxioURI |
reverseResolve(AlluxioURI alluxioURI)
Reverse resolve a ufs uri.
|
void |
setAcl(AlluxioURI alluxioURI,
SetAclAction action,
List<AclEntry> entries,
SetAclPOptions options)
Sets the ACL for a path.
|
void |
setAttribute(AlluxioURI alluxioURI,
SetAttributePOptions options)
Sets any number of a path's attributes, such as TTL and pin status.
|
void |
startSync(AlluxioURI alluxioURI)
Starts the active syncing process on an Alluxio path.
|
void |
stopSync(AlluxioURI alluxioURI)
Stops the active syncing process on an Alluxio path.
|
void |
unmount(AlluxioURI alluxioURI,
UnmountPOptions options)
Unmounts a UFS subtree identified by the given Alluxio path.
|
void |
updateMount(AlluxioURI alluxioURI,
MountPOptions options)
Updates the options for an existing mount point.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDirectory, createFile, delete, exists, free, getStatus, listStatus, mount, openFile, persist, rename, setAcl, setAttribute, unmount
public AlluxioHdfsFileSystem(org.apache.hadoop.fs.FileSystem fileSystem, org.apache.hadoop.conf.Configuration conf)
fileSystem
- hadoop file systemconf
- hadoop configurationpublic void createDirectory(AlluxioURI alluxioURI, CreateDirectoryPOptions options) throws IOException
FileSystem
createDirectory
in interface FileSystem
alluxioURI
- the path of the directory to create in Alluxio spaceoptions
- options to associate with this operationIOException
public FileInStream openFile(AlluxioURI alluxioURI, OpenFilePOptions options) throws IOException
FileSystem
openFile
in interface FileSystem
alluxioURI
- the file to read fromoptions
- options to associate with this operationFileInStream
for the given pathIOException
public FileInStream openFile(URIStatus uriStatus, OpenFilePOptions options) throws IOException
FileSystem
openFile
in interface FileSystem
uriStatus
- status of the file to read fromoptions
- options to associate with this operationFileInStream
for the given pathIOException
public FileOutStream createFile(AlluxioURI alluxioURI, CreateFilePOptions options)
FileSystem
createFile
in interface FileSystem
alluxioURI
- the path of the file to create in Alluxio spaceoptions
- options to associate with this operationFileOutStream
which will write data to the newly created filepublic void delete(AlluxioURI alluxioURI, DeletePOptions options)
FileSystem
delete
in interface FileSystem
alluxioURI
- the path to delete in Alluxio spaceoptions
- options to associate with this operationpublic boolean exists(AlluxioURI alluxioURI, ExistsPOptions options)
FileSystem
exists
in interface FileSystem
alluxioURI
- the path in questionoptions
- options to associate with this operationpublic AlluxioConfiguration getConf()
getConf
in interface FileSystem
public URIStatus getStatus(AlluxioURI alluxioURI, GetStatusPOptions options) throws IOException
FileSystem
URIStatus
object that represents the metadata of an Alluxio path.getStatus
in interface FileSystem
alluxioURI
- the path to obtain information aboutoptions
- options to associate with this operationURIStatus
of the fileIOException
public List<URIStatus> listStatus(AlluxioURI alluxioURI, ListStatusPOptions options) throws IOException
FileSystem
URIStatus
of all the direct entries in it.
Otherwise returns a list with a single URIStatus
element for the file.listStatus
in interface FileSystem
alluxioURI
- the path to list information aboutoptions
- options to associate with this operationURIStatus
s containing information about the files and directories
which are children of the given pathIOException
public boolean isClosed()
FileSystem
isClosed
in interface FileSystem
public void free(AlluxioURI alluxioURI, FreePOptions options)
FileSystem
free
in interface FileSystem
alluxioURI
- the path to free in Alluxio spaceoptions
- options to associate with this operationpublic List<BlockLocationInfo> getBlockLocations(AlluxioURI alluxioURI)
FileSystem
BlockLocationInfo
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 FileSystem
alluxioURI
- the path to get block info forpublic void mount(AlluxioURI alluxioURI1, AlluxioURI alluxioURI2, MountPOptions options)
FileSystem
AlluxioException
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 FileSystem
alluxioURI1
- an Alluxio path to mount the data toalluxioURI2
- a UFS path to mount the data fromoptions
- options to associate with this operationpublic void updateMount(AlluxioURI alluxioURI, MountPOptions options)
FileSystem
updateMount
in interface FileSystem
alluxioURI
- the Alluxio path of the mount pointoptions
- options for this mount pointpublic Map<String,MountPointInfo> getMountTable()
FileSystem
getMountTable
in interface FileSystem
MountPointInfo
public List<SyncPointInfo> getSyncPathList()
FileSystem
getSyncPathList
in interface FileSystem
public void persist(AlluxioURI alluxioURI, ScheduleAsyncPersistencePOptions options)
FileSystem
FileSystemUtils.persistAndWait(FileSystem, AlluxioURI, long)
.persist
in interface FileSystem
alluxioURI
- the uri of the file to persistoptions
- the options to use when submitting persist the pathpublic void rename(AlluxioURI source, AlluxioURI destination, RenamePOptions options)
FileSystem
rename
in interface FileSystem
source
- the path of the source, this must already existdestination
- the path of the destination, this path should not existoptions
- options to associate with this operationpublic AlluxioURI reverseResolve(AlluxioURI alluxioURI)
FileSystem
reverseResolve
in interface FileSystem
alluxioURI
- the ufs uripublic void setAcl(AlluxioURI alluxioURI, SetAclAction action, List<AclEntry> entries, SetAclPOptions options)
FileSystem
setAcl
in interface FileSystem
alluxioURI
- the path to set the ACL foraction
- the set action to performentries
- the ACL entriesoptions
- options to associate with this operationpublic void startSync(AlluxioURI alluxioURI)
FileSystem
startSync
in interface FileSystem
alluxioURI
- the path to syncpublic void stopSync(AlluxioURI alluxioURI)
FileSystem
stopSync
in interface FileSystem
alluxioURI
- the path to stop syncingpublic void setAttribute(AlluxioURI alluxioURI, SetAttributePOptions options)
FileSystem
setAttribute
in interface FileSystem
alluxioURI
- the path to set attributes foroptions
- options to associate with this operationpublic void unmount(AlluxioURI alluxioURI, UnmountPOptions options)
FileSystem
unmount
in interface FileSystem
alluxioURI
- an Alluxio path, this must be a mount pointoptions
- options to associate with this operationpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2023. All Rights Reserved.