public class DoraCacheFileSystem extends DelegatingFileSystem
Modifier and Type | Class and Description |
---|---|
static class |
DoraCacheFileSystem.DoraCacheFileSystemFactory
DoraCacheFileSystem Factory.
|
FileSystem.Factory
Modifier and Type | Field and Description |
---|---|
static int |
DUMMY_MOUNT_ID |
protected FileSystemContext |
mFsContext |
static DoraCacheFileSystem.DoraCacheFileSystemFactory |
sDoraCacheFileSystemFactory |
mDelegatedFileSystem
Modifier | Constructor and Description |
---|---|
|
DoraCacheFileSystem(FileSystem fs,
FileSystemContext context)
Wraps a file system instance to forward messages.
|
protected |
DoraCacheFileSystem(FileSystem fs,
FileSystemContext context,
DoraCacheClient doraCacheClient) |
Modifier and Type | Method and Description |
---|---|
Map<String,List<WorkerNetAddress>> |
checkFileLocation(AlluxioURI path)
Check the location of the specified path.
|
Map<String,List<WorkerNetAddress>> |
checkFileLocation(AlluxioURI path,
GetStatusPOptions options)
Check the location of the specified path.
|
AlluxioURI |
convertToAlluxioPath(AlluxioURI ufsPath)
Converts the UFS path back to Alluxio path.
|
AlluxioURI |
convertToUfsPath(AlluxioURI alluxioPath)
Converts the Alluxio based path to UfsBaseFileSystem based path if needed.
|
void |
createDirectory(AlluxioURI path,
CreateDirectoryPOptions options)
Creates a directory.
|
FileOutStream |
createFile(AlluxioURI alluxioPath,
CreateFilePOptions options)
Creates a file.
|
void |
delete(AlluxioURI path,
DeletePOptions options)
Deletes a file or a directory.
|
boolean |
exists(AlluxioURI path,
ExistsPOptions options)
Checks whether a path exists in Alluxio space.
|
List<BlockLocationInfo> |
getBlockLocations(AlluxioURI path)
Get the location information of the specified file.
|
List<BlockLocationInfo> |
getBlockLocations(URIStatus status)
Get the location information of the specified file.
|
DoraCacheFileSystem |
getDoraCacheFileSystem() |
URIStatus |
getStatus(AlluxioURI path,
GetStatusPOptions options)
Gets the
URIStatus object that represents the metadata of an Alluxio path. |
WorkerNetAddress |
getWorkerNetAddress(AlluxioURI path)
Get the worker address which the specified file locates at.
|
void |
iterateStatus(AlluxioURI path,
ListStatusPOptions options,
java.util.function.Consumer<? super URIStatus> action)
Performs a specific action on each
URIStatus in the result of FileSystem.listStatus(alluxio.AlluxioURI) . |
List<URIStatus> |
listStatus(AlluxioURI path,
ListStatusPOptions options)
If the path is a directory, returns the
URIStatus of all the direct entries in it. |
FileInStream |
openFile(AlluxioURI path,
OpenFilePOptions options)
Opens a file for reading.
|
FileInStream |
openFile(URIStatus status,
OpenFilePOptions options)
Opens a file for reading.
|
PositionReader |
openPositionRead(AlluxioURI path,
OpenFilePOptions options)
Opens a file for position reading.
|
PositionReader |
openPositionRead(URIStatus status,
OpenFilePOptions options)
Opens a file for reading.
|
void |
rename(AlluxioURI src,
AlluxioURI dst,
RenamePOptions options)
Renames an existing Alluxio path to another Alluxio path in Alluxio.
|
void |
setAttribute(AlluxioURI path,
SetAttributePOptions options)
Sets any number of a path's attributes, such as TTL and pin status.
|
void |
setUfsFallbackEnabled(boolean enabled)
Dora Cache file system implementation.
|
checkAccess, close, free, getConf, getJobProgress, getMountTable, getUfsBaseFileSystem, getUnderlyingFileSystem, isClosed, listStatusPartial, loadMetadata, mount, needsSync, persist, reverseResolve, setAcl, stopJob, submitJob, unmount, updateMount
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDirectory, createFile, delete, exists, free, getMountTable, getStatus, iterateStatus, listStatus, loadMetadata, mount, openFile, openPositionRead, persist, rename, setAcl, setAttribute, unmount
public static final int DUMMY_MOUNT_ID
public static DoraCacheFileSystem.DoraCacheFileSystemFactory sDoraCacheFileSystemFactory
protected final FileSystemContext mFsContext
public DoraCacheFileSystem(FileSystem fs, FileSystemContext context)
fs
- the underlying file systemcontext
- protected DoraCacheFileSystem(FileSystem fs, FileSystemContext context, DoraCacheClient doraCacheClient)
public URIStatus getStatus(AlluxioURI path, GetStatusPOptions options) throws IOException, AlluxioException
FileSystem
URIStatus
object that represents the metadata of an Alluxio path.getStatus
in interface FileSystem
getStatus
in class DelegatingFileSystem
path
- the path to obtain information aboutoptions
- options to associate with this operationURIStatus
of the fileFileDoesNotExistException
- if the path does not existIOException
AlluxioException
public FileInStream openFile(AlluxioURI path, OpenFilePOptions options) throws IOException, AlluxioException
FileSystem
openFile
in interface FileSystem
openFile
in class DelegatingFileSystem
path
- the file to read fromoptions
- options to associate with this operationFileInStream
for the given pathFileDoesNotExistException
- when path does not existOpenDirectoryException
- when path is a directoryFileIncompleteException
- when path is a file and is not completed yetIOException
AlluxioException
public FileInStream openFile(URIStatus status, OpenFilePOptions options) throws IOException, AlluxioException
FileSystem
openFile
in interface FileSystem
openFile
in class DelegatingFileSystem
status
- status of the file to read fromoptions
- options to associate with this operationFileInStream
for the given pathFileDoesNotExistException
- when path does not existOpenDirectoryException
- when path is a directoryFileIncompleteException
- when path is a file and is not completed yetIOException
AlluxioException
public PositionReader openPositionRead(AlluxioURI path, OpenFilePOptions options)
FileSystem
openPositionRead
in interface FileSystem
openPositionRead
in class DelegatingFileSystem
path
- the file to read fromoptions
- options to associate with this operationPositionReader
for the given pathpublic PositionReader openPositionRead(URIStatus status, OpenFilePOptions options)
FileSystem
openPositionRead
in interface FileSystem
openPositionRead
in class DelegatingFileSystem
status
- status of the file to read fromoptions
- options to associate with this operationPositionReader
for the given pathpublic List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws FileDoesNotExistException, IOException, AlluxioException
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
listStatus
in class DelegatingFileSystem
path
- 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 pathFileDoesNotExistException
- if the given path does not existIOException
AlluxioException
public FileOutStream createFile(AlluxioURI alluxioPath, CreateFilePOptions options) throws FileAlreadyExistsException, InvalidPathException, IOException, AlluxioException
FileSystem
createFile
in interface FileSystem
createFile
in class DelegatingFileSystem
alluxioPath
- the path of the file to create in Alluxio spaceoptions
- options to associate with this operationFileOutStream
which will write data to the newly created fileFileAlreadyExistsException
- if there is already a file at the given pathInvalidPathException
- if the path is invalidIOException
AlluxioException
public void createDirectory(AlluxioURI path, CreateDirectoryPOptions options) throws FileAlreadyExistsException, InvalidPathException, IOException, AlluxioException
FileSystem
createDirectory
in interface FileSystem
createDirectory
in class DelegatingFileSystem
path
- the path of the directory to create in Alluxio spaceoptions
- options to associate with this operationFileAlreadyExistsException
- if there is already a file or directory at the given pathInvalidPathException
- if the path is invalidIOException
AlluxioException
public void delete(AlluxioURI path, DeletePOptions options) throws DirectoryNotEmptyException, FileDoesNotExistException, IOException, AlluxioException
FileSystem
delete
in interface FileSystem
delete
in class DelegatingFileSystem
path
- the path to delete in Alluxio spaceoptions
- options to associate with this operationDirectoryNotEmptyException
- if recursive is false and the path is a nonempty directoryFileDoesNotExistException
- if the given path does not existIOException
AlluxioException
public void rename(AlluxioURI src, AlluxioURI dst, RenamePOptions options) throws FileDoesNotExistException, IOException, AlluxioException
FileSystem
rename
in interface FileSystem
rename
in class DelegatingFileSystem
src
- the path of the source, this must already existdst
- the path of the destination, this path should not existoptions
- options to associate with this operationFileDoesNotExistException
- if the given file does not existIOException
AlluxioException
public void iterateStatus(AlluxioURI path, ListStatusPOptions options, java.util.function.Consumer<? super URIStatus> action) throws FileDoesNotExistException, IOException, AlluxioException
FileSystem
URIStatus
in the result of FileSystem.listStatus(alluxio.AlluxioURI)
.
This method is preferred when iterating over directories with a large number of files or
sub-directories inside. The caller can proceed with partial result without waiting for all
result returned.iterateStatus
in interface FileSystem
iterateStatus
in class DelegatingFileSystem
path
- the path to list information aboutoptions
- options to associate with this operationaction
- action to apply on each URIStatus
FileDoesNotExistException
- if the given path does not existIOException
AlluxioException
public boolean exists(AlluxioURI path, ExistsPOptions options) throws InvalidPathException, IOException, AlluxioException
FileSystem
exists
in interface FileSystem
exists
in class DelegatingFileSystem
path
- the path in questionoptions
- options to associate with this operationInvalidPathException
- if the path is invalidIOException
AlluxioException
public void setAttribute(AlluxioURI path, SetAttributePOptions options) throws FileDoesNotExistException, IOException, AlluxioException
FileSystem
setAttribute
in interface FileSystem
setAttribute
in class DelegatingFileSystem
path
- the path to set attributes foroptions
- options to associate with this operationFileDoesNotExistException
- if the given file does not existIOException
AlluxioException
public AlluxioURI convertToUfsPath(AlluxioURI alluxioPath)
alluxioPath
- Alluxio based pathpublic AlluxioURI convertToAlluxioPath(AlluxioURI ufsPath) throws InvalidPathException
This is the opposite operation to convertToUfsPath(AlluxioURI)
.
ufsPath
- UfsBaseFileSystem based full pathInvalidPathException
- if ufsPath is not a child of the UFS mounted at Alluxio rootpublic WorkerNetAddress getWorkerNetAddress(AlluxioURI path)
path
- the file pathpublic Map<String,List<WorkerNetAddress>> checkFileLocation(AlluxioURI path) throws IOException
path
- the file pathIOException
public Map<String,List<WorkerNetAddress>> checkFileLocation(AlluxioURI path, GetStatusPOptions options) throws IOException
path
- the file pathoptions
- the get status optionsIOException
public List<BlockLocationInfo> getBlockLocations(AlluxioURI path) throws IOException, AlluxioException
getBlockLocations
in interface FileSystem
getBlockLocations
in class DelegatingFileSystem
path
- the path to get the location informationIOException
AlluxioException
FileDoesNotExistException
- if the given path does not existpublic List<BlockLocationInfo> getBlockLocations(URIStatus status) throws IOException, AlluxioException
getBlockLocations
in interface FileSystem
getBlockLocations
in class DelegatingFileSystem
status
- the uri of the fileIOException
AlluxioException
public void setUfsFallbackEnabled(boolean enabled)
enabled
- is ufs fall back enabled@Nullable public DoraCacheFileSystem getDoraCacheFileSystem()
getDoraCacheFileSystem
in interface FileSystem
getDoraCacheFileSystem
in class DelegatingFileSystem
DoraCacheFileSystem
Copyright © 2023. All Rights Reserved.