@ThreadSafe public final class AlluxioFuseUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AlluxioFuseUtils.CloseableFuseFileInfo
Creates a closeable fuse file info.
|
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 |
MACFUSE_SUPPORT_MINIMUM_OS_VERSION |
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 |
checkNameLength(AlluxioURI uri)
Checks the input file length.
|
static int |
compareVersion(String version1,
String version2)
Compares two version.
|
static FileOutStream |
createFile(FileSystem fileSystem,
AuthPolicy authPolicy,
AlluxioURI uri,
CreateFileStatus fileStatus)
Creates a file in alluxio namespace.
|
static void |
deletePath(FileSystem fileSystem,
AlluxioURI uri)
Deletes a file or a directory in alluxio namespace.
|
static void |
fillStat(AuthPolicy policy,
FileStat stat,
URIStatus status)
Fills the path status.
|
static void |
fillStat(FileStat stat,
CreateFileStatus status)
Fills the path status.
|
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 LibfuseVersion |
getLibfuseVersion(AlluxioConfiguration conf)
Gets the libjnifuse version preference set by user.
|
static String |
getMountedRootPath(AlluxioConfiguration conf,
FuseOptions fuseOptions)
Gets the path be mounted to local fuse mount point.
|
static com.google.common.cache.LoadingCache<String,AlluxioURI> |
getPathResolverCache(AlluxioConfiguration conf,
FuseOptions options)
Gets the cache for resolving FUSE path into
AlluxioURI . |
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 boolean |
isFuseInstalled()
Checks whether fuse is installed in local file system.
|
static boolean |
isMacFuse() |
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 void |
updateDefaultCreateFilePOptionBuilderSupplier(java.util.function.Supplier<CreateFilePOptions.Builder> supplier) |
static void |
updateStatSize(FileStat stat,
long size)
Updates file status size.
|
static 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 final String MACFUSE_SUPPORT_MINIMUM_OS_VERSION
public static void updateDefaultCreateFilePOptionBuilderSupplier(java.util.function.Supplier<CreateFilePOptions.Builder> supplier)
supplier
- the new supplierpublic static int checkNameLength(AlluxioURI uri)
uri
- the Alluxio URIpublic static FileOutStream createFile(FileSystem fileSystem, AuthPolicy authPolicy, AlluxioURI uri, CreateFileStatus fileStatus)
fileSystem
- the file systemauthPolicy
- the authentication policyuri
- the alluxio urifileStatus
- the create file statuspublic 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 void fillStat(AuthPolicy policy, FileStat stat, URIStatus status)
policy
- auth policystat
- file stat to fillstatus
- statuspublic static void fillStat(FileStat stat, CreateFileStatus status)
stat
- file stat to fillstatus
- the create file statuspublic static void updateStatSize(FileStat stat, long size)
stat
- stat to filesize
- sizepublic 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 boolean isMacFuse()
public static int compareVersion(String version1, String version2)
version1
- the first os version to compareversion2
- the second os version to comparepublic 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 descriptionpublic static String getMountedRootPath(AlluxioConfiguration conf, FuseOptions fuseOptions)
conf
- the configuration to get path fromfuseOptions
- the fuse optionspublic static com.google.common.cache.LoadingCache<String,AlluxioURI> getPathResolverCache(AlluxioConfiguration conf, FuseOptions options)
AlluxioURI
.conf
- the configurationoptions
- the FUSE optionsCopyright © 2023. All Rights Reserved.