@ThreadSafe public final class AlluxioFuseUtils extends 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 String |
INVALID_USER_GROUP_NAME |
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,
String methodName,
String description,
Object... args)
Calls the given
AlluxioFuseUtils.FuseCallable and returns its result. |
static int |
checkFileLength(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(Throwable t)
Gets the corresponding error code of a throwable.
|
static Optional<Long> |
getGidFromGroupName(String groupName)
Retrieves the gid of the given group.
|
static Optional<Long> |
getGidFromUserName(String userName)
Retrieves the primary gid of the given user.
|
static Optional<String> |
getGroupName(long gid)
Gets the group name from the group id.
|
static Optional<String> |
getGroupName(String userName)
Gets the primary group name from the user name.
|
static Optional<URIStatus> |
getPathStatus(FileSystem fileSystem,
AlluxioURI uri)
Gets the path status.
|
static long |
getSystemGid() |
static long |
getSystemUid() |
static Optional<Long> |
getUid(String userName)
Retrieves the uid of the given user.
|
static Optional<String> |
getUserName(long uid)
Gets the user name from the user id.
|
static VersionPreference |
getVersionPreference(AlluxioConfiguration conf)
Gets the libjnifuse version preference set by user.
|
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 Optional<URIStatus> |
waitForFileCompleted(FileSystem fileSystem,
AlluxioURI uri)
Waits for the file to complete.
|
public static final int MAX_NAME_LENGTH
public static final String INVALID_USER_GROUP_NAME
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 checkFileLength(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 VersionPreference getVersionPreference(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 Optional<Long> getUid(String userName)
userName
- the user namepublic static Optional<Long> getGidFromUserName(String userName)
userName
- the user namepublic static Optional<Long> getGidFromGroupName(String groupName)
groupName
- the group namepublic static Optional<String> getUserName(long uid)
uid
- user idpublic static Optional<String> getGroupName(String userName)
userName
- the user namepublic static Optional<String> getGroupName(long gid)
gid
- the group idpublic static boolean isFuseInstalled()
public static int getErrorCode(Throwable t)
t
- throwablepublic static Optional<URIStatus> getPathStatus(FileSystem fileSystem, AlluxioURI uri)
fileSystem
- the file systemuri
- the Alluxio uri to get status ofpublic static 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, String methodName, String description, 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 descriptionCopyright © 2023. All Rights Reserved.