@ThreadSafe
public class UfsStatusCache
extends java.lang.Object
AlluxioURI, i.e. /path/to/inode) to
UFS statuses.
It also allows associating a path with child inodes, so that the statuses for a specific path can
be searched for later.| Constructor and Description |
|---|
UfsStatusCache(java.util.concurrent.ExecutorService prefetchExecutor)
Create a new instance of
UfsStatusCache. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<UfsStatus> |
addChildren(AlluxioURI path,
java.util.Collection<UfsStatus> children)
Add a parent-child mapping to the status cache.
|
UfsStatus |
addStatus(AlluxioURI path,
UfsStatus status)
Add a new status to the cache.
|
void |
cancelAllPrefetch()
Interrupts and cancels any currently running prefetch jobs.
|
java.util.Collection<UfsStatus> |
fetchChildrenIfAbsent(AlluxioURI path,
MountTable mountTable)
Fetches children of a given alluxio path stores them in the cache, then returns them.
|
java.util.Collection<UfsStatus> |
fetchChildrenIfAbsent(AlluxioURI path,
MountTable mountTable,
boolean useFallback)
Fetches children of a given alluxio path, stores them in the cache, then returns them.
|
UfsStatus |
fetchStatusIfAbsent(AlluxioURI path,
MountTable mountTable)
Attempts to return a status from the cache.
|
java.util.Collection<UfsStatus> |
getChildren(AlluxioURI path)
Get the child
UfsStatuses from a given AlluxioURI. |
UfsStatus |
getStatus(AlluxioURI path)
Get the UfsStatus from a given AlluxioURI.
|
java.util.concurrent.Future<java.util.Collection<UfsStatus>> |
prefetchChildren(AlluxioURI path,
MountTable mountTable)
Submit a request to asynchronously fetch the statuses corresponding to a given directory.
|
UfsStatus |
remove(AlluxioURI path)
Remove a status from the cache.
|
public UfsStatusCache(@Nullable
java.util.concurrent.ExecutorService prefetchExecutor)
UfsStatusCache.prefetchExecutor - the executor service used to prefetch statuses. If set to null, then
calls to prefetchChildren(AlluxioURI, MountTable) will not
schedule any tasks.@Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status)
AlluxioURI must match the result of
UfsStatus.getName(). This method overrides any status currently cached for the same
URI.path - the Alluxio path to key onstatus - the ufs status to storejava.lang.IllegalArgumentException - if the status name doesn't match the final URI path component@Nullable public java.util.Collection<UfsStatus> addChildren(AlluxioURI path, java.util.Collection<UfsStatus> children)
getStatus(AlluxioURI).path - the directory inode path which contains the childrenchildren - the children of the path@Nullable public UfsStatus remove(AlluxioURI path)
UfsStatus.path - the path corresponding to the UfsStatus to remove@Nullable public UfsStatus getStatus(AlluxioURI path)
path - the path the retrieveUfsStatus or null if there is none stored@Nullable public UfsStatus fetchStatusIfAbsent(AlluxioURI path, MountTable mountTable) throws InvalidPathException
path - the path the retrievemountTable - the Alluxio mount tableUfsStatus or null if there is none storedInvalidPathException@Nullable public java.util.Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable, boolean useFallback) throws java.lang.InterruptedException, InvalidPathException
path - the Alluxio path to get the children ofmountTable - the Alluxio mount tableuseFallback - whether or not to fall back to calling the UFSInvalidPathException - if the alluxio path can't be resolved to a UFS mountjava.lang.InterruptedException@Nullable public java.util.Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable) throws java.lang.InterruptedException, InvalidPathException
path - the Alluxio pathmountTable - the Alluxio mount tableInvalidPathException - if the alluxio path can't be resolved to a UFS mountjava.lang.InterruptedException@Nullable public java.util.Collection<UfsStatus> getChildren(AlluxioURI path)
UfsStatuses from a given AlluxioURI.path - the path the retrieveUfsStatus or null if there is none stored@Nullable public java.util.concurrent.Future<java.util.Collection<UfsStatus>> prefetchChildren(AlluxioURI path, MountTable mountTable)
fetchChildrenIfAbsent(AlluxioURI, MountTable)
with the same Alluxio path.
If no ExecutorService was provided to this object before instantiation, this method is
a no-op.path - the path to prefetchmountTable - the Alluxio mount tablepublic void cancelAllPrefetch()
Copyright © 2020. All Rights Reserved.