Package alluxio.underfs
Class ConsistentUnderFileSystem
- java.lang.Object
-
- alluxio.underfs.BaseUnderFileSystem
-
- alluxio.underfs.ConsistentUnderFileSystem
-
- All Implemented Interfaces:
UnderFileSystem
,java.io.Closeable
,java.lang.AutoCloseable
public abstract class ConsistentUnderFileSystem extends BaseUnderFileSystem
Represents a consistent under filesystem which does not have eventual consistency issues.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface alluxio.underfs.UnderFileSystem
UnderFileSystem.Factory, UnderFileSystem.SpaceType
-
-
Field Summary
-
Fields inherited from class alluxio.underfs.BaseUnderFileSystem
EMPTY_ACL, mUfsConf, mUri
-
-
Constructor Summary
Constructors Constructor Description ConsistentUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf)
Creates a newConsistentUnderFileSystem
for the given uri.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
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.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.boolean
isExistingDirectory(java.lang.String path)
Checks if a directory exists in under file system.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.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.-
Methods inherited from class alluxio.underfs.BaseUnderFileSystem
create, deleteDirectory, exists, getAclPair, getActiveSyncInfo, getConfiguration, getFingerprint, getOperationMode, getParsedFingerprint, getPhysicalStores, isObjectStorage, isSeekable, listStatus, mkdirs, open, resolveUri, setAclEntries, startActiveSyncPolling, startSync, stopActiveSyncPolling, stopSync, supportsActiveSync, validatePath
-
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
cleanup, connectFromMaster, connectFromWorker, create, deleteDirectory, deleteFile, getBlockSizeByte, getDirectoryStatus, getFileLocations, getFileLocations, getFileStatus, getSpace, getStatus, getUnderFSType, isDirectory, isFile, listStatus, listStatuses, mkdirs, open, openPositionRead, renameDirectory, renameFile, setMode, setOwner, supportsFlush
-
-
-
-
Constructor Detail
-
ConsistentUnderFileSystem
public ConsistentUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf)
Creates a newConsistentUnderFileSystem
for the given uri.- Parameters:
uri
- path belonging to this under file systemufsConf
- UFS configuration
-
-
Method Detail
-
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.- 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.- Parameters:
path
- the file nameoptions
- the options for create- Returns:
- A
OutputStream
object - 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.- 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.- 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
-
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.- Parameters:
path
- of the file to delete- Returns:
- true if file was found and deleted, false otherwise
- Throws:
java.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.- Parameters:
path
- the path to the directory- Returns:
- the directory status
- Throws:
java.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.- Parameters:
path
- the path to the file- Returns:
- the file status
- Throws:
java.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.- Parameters:
path
- the path to get the status- Returns:
- the file or directory status
- 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.- Parameters:
path
- the absolute directory path- Returns:
- true if the path exists and is a directory, false otherwise
- 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.- 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.- Parameters:
path
- the file nameoptions
- to open input stream- Returns:
- The
InputStream
object - 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.- Parameters:
src
- the source directory pathdst
- the destination directory 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.- Parameters:
src
- the source file pathdst
- the destination file path- Returns:
- true if succeed, false otherwise
- Throws:
java.io.IOException
-
-