@ThreadSafe public class MetadataCachingFileSystem extends DelegatingFileSystem
FileSystem.FactorymDelegatedFileSystem| Constructor and Description |
|---|
MetadataCachingFileSystem(FileSystem fileSystem,
FileSystemContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncUpdateFileAccessTime(AlluxioURI path)
Asynchronously update file's last access time.
|
void |
close() |
void |
createDirectory(AlluxioURI path,
CreateDirectoryPOptions options)
Creates a directory.
|
FileOutStream |
createFile(AlluxioURI path,
CreateFilePOptions options)
Creates a file.
|
void |
delete(AlluxioURI path,
DeletePOptions options)
Deletes a file or a directory.
|
void |
dropMetadataCache(AlluxioURI uri)
Best efforts to drops metadata cache of a given uri,
all its ancestors and descendants.
|
void |
dropMetadataCacheAll()
Drop all metadata cache.
|
java.util.List<BlockLocationInfo> |
getBlockLocations(AlluxioURI path)
Builds a list of
BlockLocationInfo for the given file. |
long |
getMetadataCacheSize() |
URIStatus |
getStatus(AlluxioURI path,
GetStatusPOptions options)
Gets the
URIStatus object that represents the metadata of an Alluxio path. |
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). |
java.util.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.
|
void |
rename(AlluxioURI src,
AlluxioURI dst,
RenamePOptions options)
Renames an existing Alluxio path to another Alluxio path in Alluxio.
|
checkAccess, exists, free, getBlockLocations, getConf, getMountTable, getSyncPathList, isClosed, listStatusPartial, loadMetadata, mount, needsSync, openFile, persist, reverseResolve, setAcl, setAttribute, startSync, stopSync, unmount, updateMountclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDirectory, createFile, delete, exists, free, getMountTable, getStatus, iterateStatus, listStatus, loadMetadata, mount, openFile, persist, rename, setAcl, setAttribute, unmountpublic MetadataCachingFileSystem(FileSystem fileSystem, FileSystemContext context)
fileSystem - the file systemcontext - the fs contextpublic void createDirectory(AlluxioURI path, CreateDirectoryPOptions options) throws FileAlreadyExistsException, InvalidPathException, java.io.IOException, AlluxioException
FileSystemcreateDirectory in interface FileSystemcreateDirectory in class DelegatingFileSystempath - 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 invalidjava.io.IOExceptionAlluxioExceptionpublic FileOutStream createFile(AlluxioURI path, CreateFilePOptions options) throws java.io.IOException, AlluxioException
FileSystemcreateFile in interface FileSystemcreateFile in class DelegatingFileSystempath - 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 invalidjava.io.IOExceptionAlluxioExceptionpublic void delete(AlluxioURI path, DeletePOptions options) throws java.io.IOException, AlluxioException
FileSystemdelete in interface FileSystemdelete in class DelegatingFileSystempath - the path to delete in Alluxio spaceoptions - options to associate with this operationFileDoesNotExistException - if the given path does not existDirectoryNotEmptyException - if recursive is false and the path is a nonempty directoryjava.io.IOExceptionAlluxioExceptionpublic void rename(AlluxioURI src, AlluxioURI dst, RenamePOptions options) throws java.io.IOException, AlluxioException
FileSystemrename in interface FileSystemrename in class DelegatingFileSystemsrc - 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 existjava.io.IOExceptionAlluxioExceptionpublic java.util.List<BlockLocationInfo> getBlockLocations(AlluxioURI path) throws java.io.IOException, 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 FileSystemgetBlockLocations in class DelegatingFileSystempath - the path to get block info forFileDoesNotExistException - if the given path does not existjava.io.IOExceptionAlluxioExceptionpublic URIStatus getStatus(AlluxioURI path, GetStatusPOptions options) throws FileDoesNotExistException, java.io.IOException, AlluxioException
FileSystemURIStatus object that represents the metadata of an Alluxio path.getStatus in interface FileSystemgetStatus in class DelegatingFileSystempath - the path to obtain information aboutoptions - options to associate with this operationURIStatus of the fileFileDoesNotExistException - if the path does not existjava.io.IOExceptionAlluxioExceptionpublic void iterateStatus(AlluxioURI path, ListStatusPOptions options, java.util.function.Consumer<? super URIStatus> action) throws FileDoesNotExistException, java.io.IOException, AlluxioException
FileSystemURIStatus 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 FileSystemiterateStatus in class DelegatingFileSystempath - the path to list information aboutoptions - options to associate with this operationaction - action to apply on each URIStatusFileDoesNotExistException - if the given path does not existjava.io.IOExceptionAlluxioExceptionpublic java.util.List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws FileDoesNotExistException, java.io.IOException, AlluxioException
FileSystemURIStatus of all the direct entries in it.
Otherwise returns a list with a single URIStatus element for the file.listStatus in interface FileSystemlistStatus in class DelegatingFileSystempath - 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 pathFileDoesNotExistException - if the given path does not existjava.io.IOExceptionAlluxioExceptionpublic FileInStream openFile(AlluxioURI path, OpenFilePOptions options) throws FileDoesNotExistException, OpenDirectoryException, FileIncompleteException, java.io.IOException, AlluxioException
FileSystemopenFile in interface FileSystemopenFile in class DelegatingFileSystempath - 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 yetjava.io.IOExceptionAlluxioExceptionpublic void asyncUpdateFileAccessTime(AlluxioURI path)
path - the path to the filepublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class DelegatingFileSystemjava.io.IOExceptionpublic void dropMetadataCache(AlluxioURI uri)
uri - the uri need to drop metadata cachepublic void dropMetadataCacheAll()
public long getMetadataCacheSize()
Copyright © 2022. All Rights Reserved.