@ThreadSafe public final class MountTable extends Object implements DelegatingJournaled
Modifier and Type | Class and Description |
---|---|
static class |
MountTable.Resolution
This class represents a UFS path after resolution.
|
static class |
MountTable.ReverseResolution
This class represents a Alluxio path after reverse resolution.
|
class |
MountTable.State
Persistent mount table state.
|
Modifier and Type | Field and Description |
---|---|
MountTable.State |
mState
Mount table state that is preserved across restarts.
|
static String |
ROOT |
Constructor and Description |
---|
MountTable(UfsManager ufsManager,
MountInfo rootMountInfo,
java.time.Clock clock)
Creates a new instance of
MountTable . |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.function.Supplier<JournalContext> journalContext,
AlluxioURI alluxioUri,
AlluxioURI ufsUri,
long mountId,
MountPOptions options)
Mounts the given UFS path at the given Alluxio path.
|
void |
addValidated(java.util.function.Supplier<JournalContext> journalContext,
AlluxioURI alluxioUri,
AlluxioURI ufsUri,
long mountId,
MountPOptions options)
Inserts an entry into the mount table.
|
void |
checkUnderWritableMountPoint(AlluxioURI alluxioUri)
Checks to see if a write operation is allowed for the specified Alluxio path, by determining
if it is under a readonly mount point.
|
boolean |
containsMountPoint(AlluxioURI uri,
boolean containsSelf) |
long |
createUnusedMountId()
Creates a mount point ID and guarantees uniqueness.
|
boolean |
delete(java.util.function.Supplier<JournalContext> journalContext,
AlluxioURI uri,
boolean checkNestedMount)
Unmounts the given Alluxio path.
|
List<MountInfo> |
findChildrenMountPoints(AlluxioURI uri,
boolean containsSelf)
Returns the mount points under the specified path.
|
Journaled |
getDelegate() |
MountInfo |
getMountInfo(AlluxioURI uri)
Gets mount information for the path.
|
MountInfo |
getMountInfo(long mountId) |
String |
getMountPoint(AlluxioURI uri)
Returns the closest ancestor mount point the given path is nested under.
|
Map<String,MountInfo> |
getMountTable()
Returns a copy of the current mount table, the mount table is a map from Alluxio file system
URIs to the corresponding mount point information.
|
UfsManager.UfsClient |
getUfsClient(long mountId)
Get the associated ufs client with the mount id.
|
com.codahale.metrics.Counter |
getUfsSyncMetric(long mountId) |
UfsSyncPathCache |
getUfsSyncPathCache() |
Lock |
getWriteLock()
Returns the underlying write lock of the MountTable.
|
boolean |
isMountPoint(AlluxioURI uri) |
MountTable.Resolution |
resolve(AlluxioURI uri)
Resolves the given Alluxio path.
|
MountTable.ReverseResolution |
reverseResolve(AlluxioURI ufsUri)
Resolves the given Ufs path.
|
void |
update(java.util.function.Supplier<JournalContext> journalContext,
AlluxioURI alluxioUri,
long newMountId,
MountPOptions newOptions)
Update the mount point with new options and mount ID.
|
void |
validateMountPoint(AlluxioURI alluxioUri,
AlluxioURI ufsUri,
long mountId,
MountPOptions options)
Verify if the given (alluxioPath, ufsPath) can be inserted into MountTable.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyAndJournal, getCheckpointName, getJournalEntryIterator, processJournalEntry, resetState, restoreFromCheckpoint, writeToCheckpoint
public static final String ROOT
public final MountTable.State mState
public MountTable(UfsManager ufsManager, MountInfo rootMountInfo, java.time.Clock clock)
MountTable
.ufsManager
- the UFS managerrootMountInfo
- root mount infoclock
- the clockpublic Lock getWriteLock()
public void add(java.util.function.Supplier<JournalContext> journalContext, AlluxioURI alluxioUri, AlluxioURI ufsUri, long mountId, MountPOptions options) throws FileAlreadyExistsException, InvalidPathException, IOException
journalContext
- the journal contextalluxioUri
- an Alluxio path URIufsUri
- a UFS path URImountId
- the mount idoptions
- the mount optionsFileAlreadyExistsException
- if the mount point already existsInvalidPathException
- if an invalid path is encounteredIOException
public void addValidated(java.util.function.Supplier<JournalContext> journalContext, AlluxioURI alluxioUri, AlluxioURI ufsUri, long mountId, MountPOptions options)
try (LockResource mountTableLock = new LockResource(mMountTable.getWriteLock()) { mMountTable.validateMountPoint(alluxioPath, ufsPath); mMountTable.addValidated(alluxioPath, ufsPath); ... }
journalContext
- the journal contextalluxioUri
- the uri of Alluxio Mount PointufsUri
- the uri of UFS PathmountId
- the mount idoptions
- the mount optionspublic void validateMountPoint(AlluxioURI alluxioUri, AlluxioURI ufsUri, long mountId, MountPOptions options) throws FileAlreadyExistsException, InvalidPathException, IOException
alluxioUri
- the alluxio path that is about to be the mount pointufsUri
- the UFS path that is about to mountmountId
- the mount idoptions
- the mount optionsFileAlreadyExistsException
InvalidPathException
IOException
public com.codahale.metrics.Counter getUfsSyncMetric(long mountId)
mountId
- the mount idpublic boolean delete(java.util.function.Supplier<JournalContext> journalContext, AlluxioURI uri, boolean checkNestedMount)
journalContext
- journal contexturi
- an Alluxio path URIcheckNestedMount
- whether to check nested mount points before deletepublic void update(java.util.function.Supplier<JournalContext> journalContext, AlluxioURI alluxioUri, long newMountId, MountPOptions newOptions) throws InvalidPathException, FileAlreadyExistsException, IOException
journalContext
- the journal contextalluxioUri
- an Alluxio path URInewMountId
- the mount idnewOptions
- the mount optionsFileAlreadyExistsException
- if the mount point already existsInvalidPathException
- if an invalid path is encounteredIOException
public String getMountPoint(AlluxioURI uri) throws InvalidPathException
uri
- an Alluxio path URIInvalidPathException
- if an invalid path is encounteredpublic Map<String,MountInfo> getMountTable()
public boolean containsMountPoint(AlluxioURI uri, boolean containsSelf) throws InvalidPathException
uri
- the Alluxio uri to checkcontainsSelf
- cause method to return true when given uri itself is a mount pointInvalidPathException
public List<MountInfo> findChildrenMountPoints(AlluxioURI uri, boolean containsSelf) throws InvalidPathException
uri
- the Alluxio uri to checkcontainsSelf
- if the given uri itself can be a mount point and included in the returnInvalidPathException
public boolean isMountPoint(AlluxioURI uri)
uri
- an Alluxio path URI@Nullable public MountTable.ReverseResolution reverseResolve(AlluxioURI ufsUri)
ufsUri
- an Ufs path URI@Nullable public UfsManager.UfsClient getUfsClient(long mountId)
mountId
- mount id to look up ufs clientpublic MountTable.Resolution resolve(AlluxioURI uri) throws InvalidPathException
uri
- an Alluxio path URIMountTable.Resolution
representing the UFS pathInvalidPathException
- if an invalid path is encounteredpublic void checkUnderWritableMountPoint(AlluxioURI alluxioUri) throws InvalidPathException, AccessControlException
alluxioUri
- an Alluxio path URIInvalidPathException
- if the Alluxio path is invalidAccessControlException
- if the Alluxio path is under a readonly mount point@Nullable public MountInfo getMountInfo(long mountId)
mountId
- the given ufs idpublic MountInfo getMountInfo(AlluxioURI uri) throws InvalidPathException
uri
- the pathInvalidPathException
public UfsSyncPathCache getUfsSyncPathCache()
public Journaled getDelegate()
getDelegate
in interface DelegatingJournaled
public long createUnusedMountId()
Copyright © 2023. All Rights Reserved.