public abstract class AbstractUfsManager extends Object implements UfsManager
UfsManager
. Store the journal UFS and root
mount point information.Modifier and Type | Class and Description |
---|---|
static class |
AbstractUfsManager.Key
The key of the UFS cache.
|
UfsManager.UfsClient
Modifier and Type | Field and Description |
---|---|
protected com.google.common.io.Closer |
mCloser |
protected ConcurrentHashMap<AbstractUfsManager.Key,UnderFileSystem> |
mUnderFileSystemMap
Maps from key to
UnderFileSystem instances. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractUfsManager() |
Modifier and Type | Method and Description |
---|---|
void |
addMount(long mountId,
AlluxioURI ufsUri,
UnderFileSystemConfiguration ufsConf)
Keeps track of a mount id and maps it to its URI in Alluxio and configuration.
|
void |
addMountWithRecorder(long mountId,
AlluxioURI ufsUri,
UnderFileSystemConfiguration ufsConf,
Recorder recorder)
Keeps track of a mount id and maps it to its URI in Alluxio and configuration and records
the execution process.
|
void |
close() |
protected abstract void |
connectUfs(UnderFileSystem fs)
Takes any necessary actions required to establish a connection to the under file system.
|
protected AbstractUfsManager.Key |
generateKey(AlluxioURI ufsUri,
UnderFileSystemConfiguration ufsConf) |
protected Optional<UnderFileSystem> |
get(AbstractUfsManager.Key key) |
Optional<UnderFileSystem> |
get(AlluxioURI ufsUri,
UnderFileSystemConfiguration ufsConf)
Gets an instance for the given UFS URI and configuration, if such exists.
|
UfsManager.UfsClient |
get(long mountId)
Gets UFS information from the manager if this mount ID exists, or throws exception otherwise.
|
UfsManager.UfsClient |
getJournal(URI location) |
UnderFileSystem |
getOrAdd(AlluxioURI ufsUri,
UnderFileSystemConfiguration ufsConf)
Return a UFS instance if it already exists in the cache, otherwise, creates a new instance and
return it.
|
UfsManager.UfsClient |
getRoot() |
boolean |
hasMount(long mountId)
Checks if a mountId exists.
|
void |
removeMount(long mountId)
Removes the association from a mount id to a UFS instance.
|
protected final ConcurrentHashMap<AbstractUfsManager.Key,UnderFileSystem> mUnderFileSystemMap
UnderFileSystem
instances. This map keeps the entire set of UFS
instances, each keyed by their unique combination of Uri and conf information. This map
helps efficiently identify if a UFS instance in request should be created or can be reused.protected final com.google.common.io.Closer mCloser
public UnderFileSystem getOrAdd(AlluxioURI ufsUri, UnderFileSystemConfiguration ufsConf)
ufsUri
- the UFS pathufsConf
- the UFS configurationprotected AbstractUfsManager.Key generateKey(AlluxioURI ufsUri, UnderFileSystemConfiguration ufsConf)
protected abstract void connectUfs(UnderFileSystem fs) throws IOException
UnderFileSystem.connectFromMaster(String)
or
UnderFileSystem.connectFromWorker(String)
depending on the running process.IOException
public void addMount(long mountId, AlluxioURI ufsUri, UnderFileSystemConfiguration ufsConf)
UfsManager
addMount
in interface UfsManager
mountId
- the mount idufsUri
- the UFS pathufsConf
- the UFS configurationpublic void addMountWithRecorder(long mountId, AlluxioURI ufsUri, UnderFileSystemConfiguration ufsConf, Recorder recorder)
UfsManager
addMountWithRecorder
in interface UfsManager
mountId
- the mount idufsUri
- the UFS pathufsConf
- the UFS configurationrecorder
- recorder used to record the detailed execution processpublic void removeMount(long mountId)
UfsManager
removeMount
in interface UfsManager
mountId
- the mount idpublic Optional<UnderFileSystem> get(AlluxioURI ufsUri, UnderFileSystemConfiguration ufsConf)
ufsUri
- the URI of the UFSufsConf
- the configuration for the UFSprotected Optional<UnderFileSystem> get(AbstractUfsManager.Key key)
public UfsManager.UfsClient get(long mountId) throws NotFoundException, UnavailableException
UfsManager
get
in interface UfsManager
mountId
- the mount idNotFoundException
- if mount id is not found in mount tableUnavailableException
- if master is not available to query for mount tablepublic UfsManager.UfsClient getRoot()
getRoot
in interface UfsManager
public UfsManager.UfsClient getJournal(URI location)
getJournal
in interface UfsManager
location
- the journal locationpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean hasMount(long mountId)
UfsManager
hasMount
in interface UfsManager
mountId
- the mountId to checkCopyright © 2023. All Rights Reserved.