@ThreadSafe public abstract class BaseUnderFileSystem extends Object implements UnderFileSystem
UnderFileSystem
.UnderFileSystem.Factory, UnderFileSystem.SpaceType
Modifier and Type | Field and Description |
---|---|
protected UnderFileSystemConfiguration |
mUfsConf
UFS Configuration options.
|
protected AlluxioURI |
mUri
The UFS
AlluxioURI used to create this BaseUnderFileSystem . |
Modifier | Constructor and Description |
---|---|
protected |
BaseUnderFileSystem(AlluxioURI uri,
UnderFileSystemConfiguration ufsConf)
Constructs an
BaseUnderFileSystem . |
Modifier and Type | Method and Description |
---|---|
OutputStream |
create(String path)
Creates a file in the under file system with the indicated name.
|
boolean |
deleteDirectory(String path)
Deletes a directory from the under file system with the indicated name non-recursively.
|
boolean |
exists(String path)
Checks if a file or directory exists in under file system.
|
Pair<AccessControlList,DefaultAccessControlList> |
getAclPair(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.
|
AlluxioConfiguration |
getConfiguration()
Gets the under file system configuration.
|
String |
getFingerprint(String path)
Computes and returns a fingerprint for the path.
|
UfsMode |
getOperationMode(Map<String,UfsMode> physicalUfsState)
An
UnderFileSystem may be composed of one or more "physical UFS"s. |
List<String> |
getPhysicalStores()
An
UnderFileSystem may be composed of one or more "physical UFS"s. |
boolean |
isObjectStorage() |
boolean |
isSeekable()
Denotes if the under storage supports seeking.
|
UfsStatus[] |
listStatus(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(String path)
Creates the directory named by this abstract pathname.
|
InputStream |
open(String path)
Opens an
InputStream for a file in under filesystem at the indicated path. |
AlluxioURI |
resolveUri(AlluxioURI ufsBaseUri,
String alluxioPath)
Returns an
AlluxioURI representation for the UnderFileSystem given a base
UFS URI, and the Alluxio path from the base. |
void |
setAclEntries(String path,
List<AclEntry> aclEntries)
Sets the access control list of a file or directory in under file system.
|
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.
|
protected static String |
validatePath(String path)
Clean the path by creating a URI and turning it back to a string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanup, connectFromMaster, connectFromWorker, create, createNonexistingFile, createNonexistingFile, deleteDirectory, deleteExistingDirectory, deleteExistingDirectory, deleteExistingFile, deleteFile, getBlockSizeByte, getDirectoryStatus, getExistingDirectoryStatus, getExistingFileStatus, getExistingStatus, getFileLocations, getFileLocations, getFileStatus, getSpace, getStatus, getUnderFSType, isDirectory, isExistingDirectory, isFile, listStatus, mkdirs, open, openExistingFile, openExistingFile, renameDirectory, renameFile, renameRenamableDirectory, renameRenamableFile, setMode, setOwner, supportsFlush
protected final AlluxioURI mUri
AlluxioURI
used to create this BaseUnderFileSystem
.protected final UnderFileSystemConfiguration mUfsConf
protected BaseUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf)
BaseUnderFileSystem
.uri
- the AlluxioURI
used to create this ufsufsConf
- UFS configurationpublic OutputStream create(String path) throws IOException
UnderFileSystem
create
in interface UnderFileSystem
path
- the file nameOutputStream
objectIOException
public boolean deleteDirectory(String path) throws IOException
UnderFileSystem
deleteDirectory
in interface UnderFileSystem
path
- of the directory to deleteIOException
public boolean exists(String path) throws IOException
UnderFileSystem
exists
in interface UnderFileSystem
path
- the absolute pathIOException
public Pair<AccessControlList,DefaultAccessControlList> getAclPair(String path) throws IOException
UnderFileSystem
getAclPair
in interface UnderFileSystem
path
- the path to the file or directoryIOException
- if ACL is supported and enabled but cannot be retrievedpublic void setAclEntries(String path, List<AclEntry> aclEntries) throws IOException
UnderFileSystem
setAclEntries
in interface UnderFileSystem
path
- the path to the file or directoryaclEntries
- the access control list + default acl represented in a list of acl entriesIOException
public AlluxioConfiguration getConfiguration()
UnderFileSystem
getConfiguration
in interface UnderFileSystem
public String getFingerprint(String path)
UnderFileSystem
Constants.INVALID_UFS_FINGERPRINT
if there is any error.getFingerprint
in interface UnderFileSystem
path
- the path to compute the fingerprint forpublic UfsMode getOperationMode(Map<String,UfsMode> physicalUfsState)
UnderFileSystem
UnderFileSystem
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 this
UnderFileSystem
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/.getOperationMode
in interface UnderFileSystem
physicalUfsState
- the state of physical UFSs for this UnderFileSystem
; keys are
expected to be normalized (ending with /)public List<String> getPhysicalStores()
UnderFileSystem
UnderFileSystem
may be composed of one or more "physical UFS"s. This method
returns all underlying physical stores; normalized with only scheme and authority.getPhysicalStores
in interface UnderFileSystem
UnderFileSystem
is composed ofpublic boolean isObjectStorage()
isObjectStorage
in interface UnderFileSystem
public boolean isSeekable()
UnderFileSystem
SeekableUnderFileInputStream
in the UnderFileSystem.open(String, OpenOptions)
method.isSeekable
in interface UnderFileSystem
@Nullable public UfsStatus[] listStatus(String path, ListOptions options) throws IOException
UnderFileSystem
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.
listStatus
in interface UnderFileSystem
path
- the abstract pathname to listoptions
- for list directorynull
if this abstract pathname does not denote a directory.IOException
public InputStream open(String path) throws IOException
UnderFileSystem
InputStream
for a file in under filesystem at the indicated path.open
in interface UnderFileSystem
path
- the file nameInputStream
objectIOException
public boolean mkdirs(String path) throws IOException
UnderFileSystem
mkdirs
in interface UnderFileSystem
path
- the folder to createtrue
if and only if the directory was created; false
otherwiseIOException
public AlluxioURI resolveUri(AlluxioURI ufsBaseUri, String alluxioPath)
UnderFileSystem
AlluxioURI
representation for the UnderFileSystem
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.resolveUri
in interface UnderFileSystem
ufsBaseUri
- the base AlluxioURI
in the ufsalluxioPath
- the path in Alluxio from the given baseAlluxioURI
representing the Alluxio pathpublic boolean supportsActiveSync()
UnderFileSystem
supportsActiveSync
in interface UnderFileSystem
public SyncInfo getActiveSyncInfo()
UnderFileSystem
getActiveSyncInfo
in interface UnderFileSystem
public boolean startActiveSyncPolling(long txId) throws IOException
UnderFileSystem
startActiveSyncPolling
in interface UnderFileSystem
txId
- the transaction id to start receiving eventIOException
public boolean stopActiveSyncPolling()
UnderFileSystem
stopActiveSyncPolling
in interface UnderFileSystem
public void startSync(AlluxioURI uri)
UnderFileSystem
startSync
in interface UnderFileSystem
uri
- ufs uri to startpublic void stopSync(AlluxioURI uri)
UnderFileSystem
stopSync
in interface UnderFileSystem
uri
- ufs uri to stopCopyright © 2023. All Rights Reserved.