@ThreadSafe
public final class AlluxioFuseUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
AlluxioFuseUtils.FuseCallable
An interface representing a callable for FUSE APIs.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
ID_NOT_SET_VALUE |
static long |
ID_NOT_SET_VALUE_UNSIGNED |
static int |
MAX_NAME_LENGTH
Most FileSystems on linux limit the length of file name beyond 255 characters.
|
static long |
MODE_NOT_SET_VALUE |
| Modifier and Type | Method and Description |
|---|---|
static int |
call(org.slf4j.Logger logger,
AlluxioFuseUtils.FuseCallable callable,
java.lang.String methodName,
java.lang.String description,
java.lang.Object... args)
Calls the given
AlluxioFuseUtils.FuseCallable and returns its result. |
static int |
checkNameLength(AlluxioURI uri)
Checks the input file length.
|
static FileOutStream |
createFile(FileSystem fileSystem,
AuthPolicy authPolicy,
AlluxioURI uri,
long mode)
Creates a file in alluxio namespace.
|
static void |
deletePath(FileSystem fileSystem,
AlluxioURI uri)
Deletes a file or a directory in alluxio namespace.
|
static int |
getErrorCode(java.lang.Throwable t)
Gets the corresponding error code of a throwable.
|
static java.util.Optional<java.lang.Long> |
getGidFromGroupName(java.lang.String groupName)
Retrieves the gid of the given group.
|
static java.util.Optional<java.lang.Long> |
getGidFromUserName(java.lang.String userName)
Retrieves the primary gid of the given user.
|
static java.util.Optional<java.lang.String> |
getGroupName(long gid)
Gets the group name from the group id.
|
static java.util.Optional<java.lang.String> |
getGroupName(java.lang.String userName)
Gets the primary group name from the user name.
|
static LibfuseVersion |
getLibfuseVersion(AlluxioConfiguration conf)
Gets the libjnifuse version preference set by user.
|
static com.google.common.cache.LoadingCache<java.lang.String,AlluxioURI> |
getPathResolverCache(AlluxioConfiguration conf)
Gets the cache for resolving FUSE path into
AlluxioURI. |
static java.util.Optional<URIStatus> |
getPathStatus(FileSystem fileSystem,
AlluxioURI uri)
Gets the path status.
|
static long |
getSystemGid() |
static long |
getSystemUid() |
static java.util.Optional<java.lang.Long> |
getUid(java.lang.String userName)
Retrieves the uid of the given user.
|
static java.util.Optional<java.lang.String> |
getUserName(long uid)
Gets the user name from the user id.
|
static boolean |
isFuseInstalled()
Checks whether fuse is installed in local file system.
|
static void |
setAttribute(FileSystem fileSystem,
AlluxioURI uri,
SetAttributePOptions options)
Sets attribute for a file.
|
static AlluxioConfiguration |
tryLoadingConfigFromMaster(FileSystemContext fsContext)
Tries to laod Alluxio config from Alluxio Master through Grpc.
|
static java.util.Optional<URIStatus> |
waitForFileCompleted(FileSystem fileSystem,
AlluxioURI uri)
Waits for the file to complete.
|
public static final int MAX_NAME_LENGTH
public static final long ID_NOT_SET_VALUE
public static final long ID_NOT_SET_VALUE_UNSIGNED
public static final long MODE_NOT_SET_VALUE
public static int checkNameLength(AlluxioURI uri)
uri - the Alluxio URIpublic static FileOutStream createFile(FileSystem fileSystem, AuthPolicy authPolicy, AlluxioURI uri, long mode)
fileSystem - the file systemauthPolicy - the authentication policyuri - the alluxio urimode - the create modepublic static void deletePath(FileSystem fileSystem, AlluxioURI uri)
fileSystem - the file systemuri - the alluxio uripublic static void setAttribute(FileSystem fileSystem, AlluxioURI uri, SetAttributePOptions options)
fileSystem - the file systemuri - the alluxio urioptions - the set attribute optionspublic static LibfuseVersion getLibfuseVersion(AlluxioConfiguration conf)
conf - the configuration objectpublic static AlluxioConfiguration tryLoadingConfigFromMaster(FileSystemContext fsContext)
fsContext - for communicating with masterpublic static long getSystemUid()
public static long getSystemGid()
public static java.util.Optional<java.lang.Long> getUid(java.lang.String userName)
userName - the user namepublic static java.util.Optional<java.lang.Long> getGidFromUserName(java.lang.String userName)
userName - the user namepublic static java.util.Optional<java.lang.Long> getGidFromGroupName(java.lang.String groupName)
groupName - the group namepublic static java.util.Optional<java.lang.String> getUserName(long uid)
uid - user idpublic static java.util.Optional<java.lang.String> getGroupName(java.lang.String userName)
userName - the user namepublic static java.util.Optional<java.lang.String> getGroupName(long gid)
gid - the group idpublic static boolean isFuseInstalled()
public static int getErrorCode(java.lang.Throwable t)
t - throwablepublic static java.util.Optional<URIStatus> getPathStatus(FileSystem fileSystem, AlluxioURI uri)
fileSystem - the file systemuri - the Alluxio uri to get status ofpublic static java.util.Optional<URIStatus> waitForFileCompleted(FileSystem fileSystem, AlluxioURI uri)
fileSystem - the file system to get file statusuri - the file path to checkpublic static int call(org.slf4j.Logger logger,
AlluxioFuseUtils.FuseCallable callable,
java.lang.String methodName,
java.lang.String description,
java.lang.Object... args)
AlluxioFuseUtils.FuseCallable and returns its result.logger - the logger to use for this callcallable - the callable to callmethodName - the name of the method, used for metricsdescription - the format string of the description, used for loggingargs - the arguments for the descriptionpublic static com.google.common.cache.LoadingCache<java.lang.String,AlluxioURI> getPathResolverCache(AlluxioConfiguration conf)
AlluxioURI.conf - the configurationCopyright © 2023. All Rights Reserved.