Class ManagedBlockingUfsForwarder
- java.lang.Object
-
- alluxio.concurrent.ManagedBlockingUfsForwarder
-
- All Implemented Interfaces:
UnderFileSystem
,java.io.Closeable
,java.lang.AutoCloseable
public class ManagedBlockingUfsForwarder extends java.lang.Object implements UnderFileSystem
Forwarder forUnderFileSystem
objects that works through with ForkJoinPool's managed blocking. If UFS calls are being done on aForkJoinWorkerThread
, then this forwarder will make sure UFS operations are treated as blocking operations for compensating the ForkJoinPool.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface alluxio.underfs.UnderFileSystem
UnderFileSystem.Factory, UnderFileSystem.SpaceType
-
-
Constructor Summary
Constructors Constructor Description ManagedBlockingUfsForwarder(UnderFileSystem ufs)
CreatesManagedBlockingUfsForwarder
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Cleans up the under file system.void
close()
void
connectFromMaster(java.lang.String hostname)
Takes any necessary actions required to establish a connection to the under file system from the given master host e.g.void
connectFromWorker(java.lang.String hostname)
Takes any necessary actions required to establish a connection to the under file system from the given worker host e.g.java.io.OutputStream
create(java.lang.String path)
Creates a file in the under file system with the indicated name.java.io.OutputStream
create(java.lang.String path, CreateOptions options)
Creates a file in the under file system with the specifiedCreateOptions
.java.io.OutputStream
createNonexistingFile(java.lang.String path)
Creates a file in the under file system with the indicated name.java.io.OutputStream
createNonexistingFile(java.lang.String path, CreateOptions options)
Creates a file in the under file system with the specifiedCreateOptions
.boolean
deleteDirectory(java.lang.String path)
Deletes a directory from the under file system with the indicated name non-recursively.boolean
deleteDirectory(java.lang.String path, DeleteOptions options)
Deletes a directory from the under file system with the indicated name.boolean
deleteExistingDirectory(java.lang.String path)
Deletes a directory from the under file system.boolean
deleteExistingDirectory(java.lang.String path, DeleteOptions options)
Deletes a directory from the under file system with the indicated name.boolean
deleteExistingFile(java.lang.String path)
Deletes a file from the under file system with the indicated name.boolean
deleteFile(java.lang.String path)
Deletes a file from the under file system with the indicated name.boolean
exists(java.lang.String path)
Checks if a file or directory exists in under file system.Pair<AccessControlList,DefaultAccessControlList>
getAclPair(java.lang.String path)
Gets the ACL and the Default ACL of a file or directory in under file system.SyncInfo
getActiveSyncInfo()
Return the active sync info for the specified syncPoints.long
getBlockSizeByte(java.lang.String path)
Gets the block size of a file in under file system, in bytes.AlluxioConfiguration
getConfiguration()
Gets the under file system configuration.UfsDirectoryStatus
getDirectoryStatus(java.lang.String path)
Gets the directory status.UfsDirectoryStatus
getExistingDirectoryStatus(java.lang.String path)
Gets the directory status.UfsFileStatus
getExistingFileStatus(java.lang.String path)
Gets the file status.UfsStatus
getExistingStatus(java.lang.String path)
Gets the file or directory status.java.util.List<java.lang.String>
getFileLocations(java.lang.String path)
Gets the list of locations of the indicated path.java.util.List<java.lang.String>
getFileLocations(java.lang.String path, FileLocationOptions options)
Gets the list of locations of the indicated path given options.UfsFileStatus
getFileStatus(java.lang.String path)
Gets the file status.java.lang.String
getFingerprint(java.lang.String path)
Computes and returns a fingerprint for the path.UfsMode
getOperationMode(java.util.Map<java.lang.String,UfsMode> physicalUfsState)
AnUnderFileSystem
may be composed of one or more "physical UFS"s.Fingerprint
getParsedFingerprint(java.lang.String path)
Computes and returns a fingerprint for the path.java.util.List<java.lang.String>
getPhysicalStores()
AnUnderFileSystem
may be composed of one or more "physical UFS"s.long
getSpace(java.lang.String path, UnderFileSystem.SpaceType type)
Queries the under file system about the space of the indicated path (e.g., space left, space used and etc).UfsStatus
getStatus(java.lang.String path)
Gets the file or directory status.java.lang.String
getUnderFSType()
Returns the name of the under filesystem implementation.boolean
isDirectory(java.lang.String path)
Checks if a directory exists in under file system.boolean
isExistingDirectory(java.lang.String path)
Checks if a directory exists in under file system.boolean
isFile(java.lang.String path)
Checks if a file exists in under file system.boolean
isObjectStorage()
boolean
isSeekable()
Denotes if the under storage supports seeking.UfsStatus[]
listStatus(java.lang.String path)
Returns an array of statuses of the files and directories in the directory denoted by this abstract pathname.UfsStatus[]
listStatus(java.lang.String path, ListOptions options)
Returns an array of statuses of the files and directories in the directory denoted by this abstract pathname, with options.boolean
mkdirs(java.lang.String path)
Creates the directory named by this abstract pathname.boolean
mkdirs(java.lang.String path, MkdirsOptions options)
Creates the directory named by this abstract pathname, with specifiedMkdirsOptions
.java.io.InputStream
open(java.lang.String path)
Opens anInputStream
for a file in under filesystem at the indicated path.java.io.InputStream
open(java.lang.String path, OpenOptions options)
Opens anInputStream
for a file in under filesystem at the indicated path.java.io.InputStream
openExistingFile(java.lang.String path)
Opens anInputStream
for a file in under filesystem at the indicated path.java.io.InputStream
openExistingFile(java.lang.String path, OpenOptions options)
Opens anInputStream
for a file in under filesystem at the indicated path.PositionReader
openPositionRead(java.lang.String path, long fileLength)
Opens a file for position read.boolean
renameDirectory(java.lang.String src, java.lang.String dst)
Renames a directory fromsrc
todst
in under file system.boolean
renameFile(java.lang.String src, java.lang.String dst)
Renames a file fromsrc
todst
in under file system.boolean
renameRenamableDirectory(java.lang.String src, java.lang.String dst)
Renames a directory fromsrc
todst
in under file system.boolean
renameRenamableFile(java.lang.String src, java.lang.String dst)
Renames a file fromsrc
todst
in under file system.AlluxioURI
resolveUri(AlluxioURI ufsBaseUri, java.lang.String alluxioPath)
Returns anAlluxioURI
representation for theUnderFileSystem
given a base UFS URI, and the Alluxio path from the base.void
setAclEntries(java.lang.String path, java.util.List<AclEntry> aclEntries)
Sets the access control list of a file or directory in under file system.void
setMode(java.lang.String path, short mode)
Changes posix file mode.void
setOwner(java.lang.String path, java.lang.String owner, java.lang.String group)
Sets the user and group of the given path.boolean
startActiveSyncPolling(long txId)
Start Active Sync.void
startSync(AlluxioURI uri)
Add Sync Point.boolean
stopActiveSyncPolling()
Stop Active Sync.void
stopSync(AlluxioURI uri)
Stop Sync Point.boolean
supportsActiveSync()
Whether this type of UFS supports active sync.boolean
supportsFlush()
Whether this type of UFS supports flush.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface alluxio.underfs.UnderFileSystem
listStatuses
-
-
-
-
Constructor Detail
-
ManagedBlockingUfsForwarder
public ManagedBlockingUfsForwarder(UnderFileSystem ufs)
CreatesManagedBlockingUfsForwarder
instance.- Parameters:
ufs
- the underlying ufs
-
-
Method Detail
-
cleanup
public void cleanup() throws java.io.IOException
Description copied from interface:UnderFileSystem
Cleans up the under file system. If any data or files are created and not completed/aborted correctly in normal ways, they should be cleaned in this method.- Specified by:
cleanup
in interfaceUnderFileSystem
- Throws:
java.io.IOException
-
connectFromMaster
public void connectFromMaster(java.lang.String hostname) throws java.io.IOException
Description copied from interface:UnderFileSystem
Takes any necessary actions required to establish a connection to the under file system from the given master host e.g. logging inDepending on the implementation this may be a no-op
- Specified by:
connectFromMaster
in interfaceUnderFileSystem
- Parameters:
hostname
- the host that wants to connect to the under file system- Throws:
java.io.IOException
-
connectFromWorker
public void connectFromWorker(java.lang.String hostname) throws java.io.IOException
Description copied from interface:UnderFileSystem
Takes any necessary actions required to establish a connection to the under file system from the given worker host e.g. logging inDepending on the implementation this may be a no-op
- Specified by:
connectFromWorker
in interfaceUnderFileSystem
- Parameters:
hostname
- the host that wants to connect to the under file system- Throws:
java.io.IOException
-
create
public java.io.OutputStream create(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates a file in the under file system with the indicated name. Parents directories will be created recursively.- Specified by:
create
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- A
OutputStream
object - Throws:
java.io.IOException
-
create
public java.io.OutputStream create(java.lang.String path, CreateOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates a file in the under file system with the specifiedCreateOptions
. Implementations should make sure that the path under creation appears in listings only after a successful close and that contents are written in its entirety or not at all.- Specified by:
create
in interfaceUnderFileSystem
- Parameters:
path
- the file nameoptions
- the options for create- Returns:
- A
OutputStream
object - Throws:
java.io.IOException
-
createNonexistingFile
public java.io.OutputStream createNonexistingFile(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates a file in the under file system with the indicated name. Similar toUnderFileSystem.create(String)
but deals with the delete-then-create eventual consistency issue.- Specified by:
createNonexistingFile
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- A
OutputStream
object - Throws:
java.io.IOException
-
createNonexistingFile
public java.io.OutputStream createNonexistingFile(java.lang.String path, CreateOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates a file in the under file system with the specifiedCreateOptions
. Similar toUnderFileSystem.create(String, CreateOptions)
but deals with the delete-then-create eventual consistency issue.- Specified by:
createNonexistingFile
in interfaceUnderFileSystem
- Parameters:
path
- the file nameoptions
- the options for create- Returns:
- A
OutputStream
object - Throws:
java.io.IOException
-
deleteDirectory
public boolean deleteDirectory(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a directory from the under file system with the indicated name non-recursively. A non-recursive delete is successful only if the directory is empty.- Specified by:
deleteDirectory
in interfaceUnderFileSystem
- Parameters:
path
- of the directory to delete- Returns:
- true if directory was found and deleted, false otherwise
- Throws:
java.io.IOException
-
deleteDirectory
public boolean deleteDirectory(java.lang.String path, DeleteOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a directory from the under file system with the indicated name.- Specified by:
deleteDirectory
in interfaceUnderFileSystem
- Parameters:
path
- of the directory to deleteoptions
- for directory delete semantics- Returns:
- true if directory was found and deleted, false otherwise
- Throws:
java.io.IOException
-
deleteExistingDirectory
public boolean deleteExistingDirectory(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a directory from the under file system. Similar toUnderFileSystem.deleteDirectory(String)
but deals with the create-delete eventual consistency issue.- Specified by:
deleteExistingDirectory
in interfaceUnderFileSystem
- Parameters:
path
- of the directory to delete- Returns:
- true if directory was found and deleted, false otherwise
- Throws:
java.io.IOException
-
deleteExistingDirectory
public boolean deleteExistingDirectory(java.lang.String path, DeleteOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a directory from the under file system with the indicated name. Similar toUnderFileSystem.deleteDirectory(String, DeleteOptions)
but deals with the create-then-delete eventual consistency issue.- Specified by:
deleteExistingDirectory
in interfaceUnderFileSystem
- Parameters:
path
- of the directory to deleteoptions
- for directory delete semantics- Returns:
- true if directory was found and deleted, false otherwise
- Throws:
java.io.IOException
-
deleteFile
public boolean deleteFile(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a file from the under file system with the indicated name.- Specified by:
deleteFile
in interfaceUnderFileSystem
- Parameters:
path
- of the file to delete- Returns:
- true if file was found and deleted, false otherwise
- Throws:
java.io.IOException
-
deleteExistingFile
public boolean deleteExistingFile(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Deletes a file from the under file system with the indicated name. Similar toUnderFileSystem.deleteFile(String)
but deals with the create-then-delete eventual consistency issue.- Specified by:
deleteExistingFile
in interfaceUnderFileSystem
- Parameters:
path
- of the file to delete- Returns:
- true if file was found and deleted, false otherwise
- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Checks if a file or directory exists in under file system.- Specified by:
exists
in interfaceUnderFileSystem
- Parameters:
path
- the absolute path- Returns:
- true if the path exists, false otherwise
- Throws:
java.io.IOException
-
getAclPair
public Pair<AccessControlList,DefaultAccessControlList> getAclPair(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the ACL and the Default ACL of a file or directory in under file system.- Specified by:
getAclPair
in interfaceUnderFileSystem
- Parameters:
path
- the path to the file or directory- Returns:
- the access control list, along with a Default ACL if it is a directory return null if ACL is unsupported or disabled
- Throws:
java.io.IOException
- if ACL is supported and enabled but cannot be retrieved
-
getBlockSizeByte
public long getBlockSizeByte(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the block size of a file in under file system, in bytes.- Specified by:
getBlockSizeByte
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- the block size in bytes
- Throws:
java.io.IOException
-
getConfiguration
public AlluxioConfiguration getConfiguration() throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the under file system configuration.- Specified by:
getConfiguration
in interfaceUnderFileSystem
- Returns:
- the configuration
- Throws:
java.io.IOException
-
getDirectoryStatus
public UfsDirectoryStatus getDirectoryStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the directory status. The caller must already know the path is a directory. This method will throw an exception if the path exists, but is a file.- Specified by:
getDirectoryStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to the directory- Returns:
- the directory status
- Throws:
java.io.FileNotFoundException
- when the path does not existjava.io.IOException
-
getExistingDirectoryStatus
public UfsDirectoryStatus getExistingDirectoryStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the directory status. Similar toUnderFileSystem.getDirectoryStatus(String)
but deals with the write-then-get-status eventual consistency issue.- Specified by:
getExistingDirectoryStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to the directory- Returns:
- the directory status
- Throws:
java.io.IOException
-
getFileLocations
public java.util.List<java.lang.String> getFileLocations(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the list of locations of the indicated path.- Specified by:
getFileLocations
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- The list of locations
- Throws:
java.io.IOException
-
getFileLocations
public java.util.List<java.lang.String> getFileLocations(java.lang.String path, FileLocationOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the list of locations of the indicated path given options.- Specified by:
getFileLocations
in interfaceUnderFileSystem
- Parameters:
path
- the file nameoptions
- method options- Returns:
- The list of locations
- Throws:
java.io.IOException
-
getFileStatus
public UfsFileStatus getFileStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the file status. The caller must already know the path is a file. This method will throw an exception if the path exists, but is a directory.- Specified by:
getFileStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to the file- Returns:
- the file status
- Throws:
java.io.FileNotFoundException
- when the path does not existjava.io.IOException
-
getExistingFileStatus
public UfsFileStatus getExistingFileStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the file status. Similar toUnderFileSystem.getFileStatus(String)
but deals with the write-then-get-status eventual consistency issue.- Specified by:
getExistingFileStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to the file- Returns:
- the file status
- Throws:
java.io.IOException
-
getFingerprint
public java.lang.String getFingerprint(java.lang.String path)
Description copied from interface:UnderFileSystem
Computes and returns a fingerprint for the path. The fingerprint is used to determine if two UFS files are identical. The fingerprint must be deterministic, and must not change if a file is only renamed (identical content and permissions). ReturnsConstants.INVALID_UFS_FINGERPRINT
if there is any error.- Specified by:
getFingerprint
in interfaceUnderFileSystem
- Parameters:
path
- the path to compute the fingerprint for- Returns:
- the string representing the fingerprint
-
getParsedFingerprint
public Fingerprint getParsedFingerprint(java.lang.String path)
Description copied from interface:UnderFileSystem
Computes and returns a fingerprint for the path. The fingerprint is used to determine if two UFS files are identical. The fingerprint must be deterministic, and must not change if a file is only renamed (identical content and permissions). ReturnsFingerprint.INVALID_FINGERPRINT
if there is any error. The default implementation relies onUnderFileSystem.getFingerprint(String)
and there is one extra parsing. This default implementation is mainly for backward compatibility. Override this for performance.- Specified by:
getParsedFingerprint
in interfaceUnderFileSystem
- Parameters:
path
- the path to compute the fingerprint for- Returns:
- the string representing the fingerprint
-
getOperationMode
public UfsMode getOperationMode(java.util.Map<java.lang.String,UfsMode> physicalUfsState)
Description copied from interface:UnderFileSystem
AnUnderFileSystem
may be composed of one or more "physical UFS"s. This method is used to determine the operation mode based on the physical UFS operation modes. For example, if thisUnderFileSystem
is composed of physical UFS hdfs://ns1/ and hdfs://ns2/ with read operations split b/w the two, with physicalUfsState{hdfs://ns1/:NO_ACCESS, hdfs://ns2/:READ_WRITE} this method can return READ_ONLY to allow reads to proceed from hdfs://ns2/.- Specified by:
getOperationMode
in interfaceUnderFileSystem
- Parameters:
physicalUfsState
- the state of physical UFSs for thisUnderFileSystem
; keys are expected to be normalized (ending with /)- Returns:
- the desired operation mode for this UFS
-
getPhysicalStores
public java.util.List<java.lang.String> getPhysicalStores()
Description copied from interface:UnderFileSystem
AnUnderFileSystem
may be composed of one or more "physical UFS"s. This method returns all underlying physical stores; normalized with only scheme and authority.- Specified by:
getPhysicalStores
in interfaceUnderFileSystem
- Returns:
- physical UFSs this
UnderFileSystem
is composed of
-
getSpace
public long getSpace(java.lang.String path, UnderFileSystem.SpaceType type) throws java.io.IOException
Description copied from interface:UnderFileSystem
Queries the under file system about the space of the indicated path (e.g., space left, space used and etc).- Specified by:
getSpace
in interfaceUnderFileSystem
- Parameters:
path
- the path to querytype
- the type of queries- Returns:
- The space in bytes
- Throws:
java.io.IOException
-
getStatus
public UfsStatus getStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the file or directory status. The caller does not need to know if the path is a file or directory. This method will determine the path type, and will return the appropriate status.- Specified by:
getStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to get the status- Returns:
- the file or directory status
- Throws:
java.io.FileNotFoundException
- when the path does not existjava.io.IOException
-
getExistingStatus
public UfsStatus getExistingStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Gets the file or directory status. Similar toUnderFileSystem.getStatus(String)
but deals with the write-then-get-status eventual consistency issue.- Specified by:
getExistingStatus
in interfaceUnderFileSystem
- Parameters:
path
- the path to get the status- Returns:
- the file or directory status
- Throws:
java.io.IOException
-
getUnderFSType
public java.lang.String getUnderFSType()
Description copied from interface:UnderFileSystem
Returns the name of the under filesystem implementation. The name should be lowercase and not include any spaces, e.g. "hdfs", "s3".- Specified by:
getUnderFSType
in interfaceUnderFileSystem
- Returns:
- name of the under filesystem implementation
-
isDirectory
public boolean isDirectory(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Checks if a directory exists in under file system.- Specified by:
isDirectory
in interfaceUnderFileSystem
- Parameters:
path
- the absolute directory path- Returns:
- true if the path exists and is a directory, false otherwise
- Throws:
java.io.IOException
-
isExistingDirectory
public boolean isExistingDirectory(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Checks if a directory exists in under file system. Similar toUnderFileSystem.isDirectory(String)
but deals with the write-then-list eventual consistency issue.- Specified by:
isExistingDirectory
in interfaceUnderFileSystem
- Parameters:
path
- the absolute directory path- Returns:
- true if the path exists and is a directory, false otherwise
- Throws:
java.io.IOException
-
isFile
public boolean isFile(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Checks if a file exists in under file system.- Specified by:
isFile
in interfaceUnderFileSystem
- Parameters:
path
- the absolute file path- Returns:
- true if the path exists and is a file, false otherwise
- Throws:
java.io.IOException
-
isObjectStorage
public boolean isObjectStorage()
- Specified by:
isObjectStorage
in interfaceUnderFileSystem
- Returns:
- true if under storage is an object store, false otherwise
-
isSeekable
public boolean isSeekable()
Description copied from interface:UnderFileSystem
Denotes if the under storage supports seeking. Note, the under file system subclass that returns true for this method should return the input stream extendingSeekableUnderFileInputStream
in theUnderFileSystem.open(String, OpenOptions)
method.- Specified by:
isSeekable
in interfaceUnderFileSystem
- Returns:
- true if under storage is seekable, false otherwise
-
listStatus
public UfsStatus[] listStatus(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Returns an array of statuses of the files and directories in the directory denoted by this abstract pathname.If this abstract pathname does not denote a directory, then this method returns
null
. Otherwise an array of statuses is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
- Specified by:
listStatus
in interfaceUnderFileSystem
- Parameters:
path
- the abstract pathname to list- Returns:
- An array with the statuses of the files and directories in the directory denoted by
this abstract pathname. The array will be empty if the directory is empty. Returns
null
if this abstract pathname does not denote a directory. - Throws:
java.io.IOException
-
listStatus
public UfsStatus[] listStatus(java.lang.String path, ListOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Returns an array of statuses of the files and directories in the directory denoted by this abstract pathname, with options.If this abstract pathname does not denote a directory, then this method returns
null
. Otherwise an array of statuses is returned, one for each file or directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a path relative to the given directory.There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
- Specified by:
listStatus
in interfaceUnderFileSystem
- Parameters:
path
- the abstract pathname to listoptions
- for list directory- Returns:
- An array of statuses naming the files and directories in the directory denoted by this
abstract pathname. The array will be empty if the directory is empty. Returns
null
if this abstract pathname does not denote a directory. - Throws:
java.io.IOException
-
mkdirs
public boolean mkdirs(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates the directory named by this abstract pathname. If the folder already exists, the method returns false. The method creates any necessary but nonexistent parent directories.- Specified by:
mkdirs
in interfaceUnderFileSystem
- Parameters:
path
- the folder to create- Returns:
true
if and only if the directory was created;false
otherwise- Throws:
java.io.IOException
-
mkdirs
public boolean mkdirs(java.lang.String path, MkdirsOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Creates the directory named by this abstract pathname, with specifiedMkdirsOptions
. If the folder already exists, the method returns false.- Specified by:
mkdirs
in interfaceUnderFileSystem
- Parameters:
path
- the folder to createoptions
- the options for mkdirs- Returns:
true
if and only if the directory was created;false
otherwise- Throws:
java.io.IOException
-
open
public java.io.InputStream open(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Opens anInputStream
for a file in under filesystem at the indicated path.- Specified by:
open
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- The
InputStream
object - Throws:
java.io.IOException
-
open
public java.io.InputStream open(java.lang.String path, OpenOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Opens anInputStream
for a file in under filesystem at the indicated path.- Specified by:
open
in interfaceUnderFileSystem
- Parameters:
path
- the file nameoptions
- to open input stream- Returns:
- The
InputStream
object - Throws:
java.io.IOException
-
openExistingFile
public java.io.InputStream openExistingFile(java.lang.String path) throws java.io.IOException
Description copied from interface:UnderFileSystem
Opens anInputStream
for a file in under filesystem at the indicated path. Similar toUnderFileSystem.open(String)
but deals with the write-then-read eventual consistency issue.- Specified by:
openExistingFile
in interfaceUnderFileSystem
- Parameters:
path
- the file name- Returns:
- The
InputStream
object - Throws:
java.io.IOException
-
openExistingFile
public java.io.InputStream openExistingFile(java.lang.String path, OpenOptions options) throws java.io.IOException
Description copied from interface:UnderFileSystem
Opens anInputStream
for a file in under filesystem at the indicated path. Similar toUnderFileSystem.open(String, OpenOptions)
but deals with the write-then-read eventual consistency issue.- Specified by:
openExistingFile
in interfaceUnderFileSystem
- Parameters:
path
- the file nameoptions
- to open input stream- Returns:
- The
InputStream
object - Throws:
java.io.IOException
-
openPositionRead
public PositionReader openPositionRead(java.lang.String path, long fileLength)
Description copied from interface:UnderFileSystem
Opens a file for position read.- Specified by:
openPositionRead
in interfaceUnderFileSystem
- Parameters:
path
- the path to readfileLength
- the file length- Returns:
- the position reader
-
renameDirectory
public boolean renameDirectory(java.lang.String src, java.lang.String dst) throws java.io.IOException
Description copied from interface:UnderFileSystem
Renames a directory fromsrc
todst
in under file system.- Specified by:
renameDirectory
in interfaceUnderFileSystem
- Parameters:
src
- the source directory pathdst
- the destination directory path- Returns:
- true if succeed, false otherwise
- Throws:
java.io.IOException
-
renameRenamableDirectory
public boolean renameRenamableDirectory(java.lang.String src, java.lang.String dst) throws java.io.IOException
Description copied from interface:UnderFileSystem
Renames a directory fromsrc
todst
in under file system. Similar toUnderFileSystem.renameDirectory(String, String)
but deals with the write-src-then-rename and delete-dst-then-rename eventual consistency issue.- Specified by:
renameRenamableDirectory
in interfaceUnderFileSystem
- Parameters:
src
- the source directory pathdst
- the destination directory path- Returns:
- true if succeed, false otherwise
- Throws:
java.io.IOException
-
renameFile
public boolean renameFile(java.lang.String src, java.lang.String dst) throws java.io.IOException
Description copied from interface:UnderFileSystem
Renames a file fromsrc
todst
in under file system.- Specified by:
renameFile
in interfaceUnderFileSystem
- Parameters:
src
- the source file pathdst
- the destination file path- Returns:
- true if succeed, false otherwise
- Throws:
java.io.IOException
-
renameRenamableFile
public boolean renameRenamableFile(java.lang.String src, java.lang.String dst) throws java.io.IOException
Description copied from interface:UnderFileSystem
Renames a file fromsrc
todst
in under file system. Similar toUnderFileSystem.renameFile(String, String)
but deals with the write-src-then-rename and delete-dst-then-rename eventual consistency issue.- Specified by:
renameRenamableFile
in interfaceUnderFileSystem
- Parameters:
src
- the source file pathdst
- the destination file path- Returns:
- true if succeed, false otherwise
- Throws:
java.io.IOException
-
resolveUri
public AlluxioURI resolveUri(AlluxioURI ufsBaseUri, java.lang.String alluxioPath)
Description copied from interface:UnderFileSystem
Returns anAlluxioURI
representation for theUnderFileSystem
given a base UFS URI, and the Alluxio path from the base. The default implementation simply concatenates the path to the base URI. This should be overridden if a subclass needs alternate functionality.- Specified by:
resolveUri
in interfaceUnderFileSystem
- Parameters:
ufsBaseUri
- the baseAlluxioURI
in the ufsalluxioPath
- the path in Alluxio from the given base- Returns:
- the UFS
AlluxioURI
representing the Alluxio path
-
setAclEntries
public void setAclEntries(java.lang.String path, java.util.List<AclEntry> aclEntries) throws java.io.IOException
Description copied from interface:UnderFileSystem
Sets the access control list of a file or directory in under file system. if the ufs does not support acls, this is a noop. This will overwrite the ACL and defaultACL in the UFS.- Specified by:
setAclEntries
in interfaceUnderFileSystem
- Parameters:
path
- the path to the file or directoryaclEntries
- the access control list + default acl represented in a list of acl entries- Throws:
java.io.IOException
-
setMode
public void setMode(java.lang.String path, short mode) throws java.io.IOException
Description copied from interface:UnderFileSystem
Changes posix file mode.- Specified by:
setMode
in interfaceUnderFileSystem
- Parameters:
path
- the path of the filemode
- the mode to set in short format, e.g. 0777- Throws:
java.io.IOException
-
setOwner
public void setOwner(java.lang.String path, java.lang.String owner, java.lang.String group) throws java.io.IOException
Description copied from interface:UnderFileSystem
Sets the user and group of the given path. An empty implementation should be provided if unsupported.- Specified by:
setOwner
in interfaceUnderFileSystem
- Parameters:
path
- the path of the fileowner
- the new owner to set, unchanged if nullgroup
- the new group to set, unchanged if null- Throws:
java.io.IOException
-
supportsFlush
public boolean supportsFlush() throws java.io.IOException
Description copied from interface:UnderFileSystem
Whether this type of UFS supports flush.- Specified by:
supportsFlush
in interfaceUnderFileSystem
- Returns:
- true if this type of UFS supports flush, false otherwise
- Throws:
java.io.IOException
-
supportsActiveSync
public boolean supportsActiveSync()
Description copied from interface:UnderFileSystem
Whether this type of UFS supports active sync.- Specified by:
supportsActiveSync
in interfaceUnderFileSystem
- Returns:
- true if this type of UFS supports active sync, false otherwise
-
getActiveSyncInfo
public SyncInfo getActiveSyncInfo() throws java.io.IOException
Description copied from interface:UnderFileSystem
Return the active sync info for the specified syncPoints.- Specified by:
getActiveSyncInfo
in interfaceUnderFileSystem
- Returns:
- active sync info consisting of what changed for these sync points
- Throws:
java.io.IOException
-
startSync
public void startSync(AlluxioURI uri) throws java.io.IOException
Description copied from interface:UnderFileSystem
Add Sync Point.- Specified by:
startSync
in interfaceUnderFileSystem
- Parameters:
uri
- ufs uri to start- Throws:
java.io.IOException
-
stopSync
public void stopSync(AlluxioURI uri) throws java.io.IOException
Description copied from interface:UnderFileSystem
Stop Sync Point.- Specified by:
stopSync
in interfaceUnderFileSystem
- Parameters:
uri
- ufs uri to stop- Throws:
java.io.IOException
-
startActiveSyncPolling
public boolean startActiveSyncPolling(long txId) throws java.io.IOException
Description copied from interface:UnderFileSystem
Start Active Sync.- Specified by:
startActiveSyncPolling
in interfaceUnderFileSystem
- Parameters:
txId
- the transaction id to start receiving event- Returns:
- true if active sync started
- Throws:
java.io.IOException
-
stopActiveSyncPolling
public boolean stopActiveSyncPolling() throws java.io.IOException
Description copied from interface:UnderFileSystem
Stop Active Sync.- Specified by:
stopActiveSyncPolling
in interfaceUnderFileSystem
- Returns:
- true if active sync stopped
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-