Package alluxio.util
Class IdUtils
- java.lang.Object
-
- alluxio.util.IdUtils
-
@ThreadSafe public final class IdUtils extends java.lang.Object
Utility methods for working with an id in Alluxio.
-
-
Field Summary
Fields Modifier and Type Field Description static long
INVALID_FILE_ID
static long
INVALID_MOUNT_ID
static long
INVALID_WORKER_ID
static long
ROOT_MOUNT_ID
static long
UFS_JOURNAL_MOUNT_ID
The journal ufs is stored as a special mount in the ufs manage.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
createFileId(long containerId)
Creates an id for a file based on the given id of the container.static java.lang.String
createFileSystemContextId()
static long
createMountId()
static java.lang.String
createOrGetAppIdFromConfig(AlluxioConfiguration conf)
static java.lang.String
createRpcId()
static long
createSessionId()
static long
fileIdFromBlockId(long blockId)
Creates a file ID from a block ID.static long
getRandomNonNegativeLong()
Generates a positive random number by zero-ing the sign bit.
-
-
-
Field Detail
-
INVALID_FILE_ID
public static final long INVALID_FILE_ID
- See Also:
- Constant Field Values
-
INVALID_WORKER_ID
public static final long INVALID_WORKER_ID
- See Also:
- Constant Field Values
-
INVALID_MOUNT_ID
public static final long INVALID_MOUNT_ID
- See Also:
- Constant Field Values
-
ROOT_MOUNT_ID
public static final long ROOT_MOUNT_ID
- See Also:
- Constant Field Values
-
UFS_JOURNAL_MOUNT_ID
public static final long UFS_JOURNAL_MOUNT_ID
The journal ufs is stored as a special mount in the ufs manage.- See Also:
- Constant Field Values
-
-
Method Detail
-
createFileId
public static long createFileId(long containerId)
Creates an id for a file based on the given id of the container.- Parameters:
containerId
- the id of the container- Returns:
- a file id based on the given container id
-
fileIdFromBlockId
public static long fileIdFromBlockId(long blockId)
Creates a file ID from a block ID.- Parameters:
blockId
- the block ID- Returns:
- the file ID
-
createRpcId
public static java.lang.String createRpcId()
- Returns:
- the created RPC id
-
getRandomNonNegativeLong
public static long getRandomNonNegativeLong()
Generates a positive random number by zero-ing the sign bit.- Returns:
- a random long which is guaranteed to be non negative (zero is allowed)
-
createSessionId
public static long createSessionId()
- Returns:
- a session ID
-
createMountId
public static long createMountId()
- Returns:
- a random long which is guaranteed to be non negative (zero is allowed)
-
createFileSystemContextId
public static java.lang.String createFileSystemContextId()
- Returns:
- app suffixed by a positive random long
-
createOrGetAppIdFromConfig
public static java.lang.String createOrGetAppIdFromConfig(AlluxioConfiguration conf)
- Parameters:
conf
- an alluxio configuration with the USER_APP_ID property key- Returns:
- a string representing the USER_APP_ID
-
-