@NotThreadSafe public final class DefaultTempBlockMeta extends Object implements TempBlockMeta
Constructor and Description |
---|
DefaultTempBlockMeta(long sessionId,
long blockId,
long initialBlockSize,
StorageDir dir)
Creates a new instance of
DefaultTempBlockMeta . |
Modifier and Type | Method and Description |
---|---|
long |
getBlockId() |
BlockStoreLocation |
getBlockLocation() |
long |
getBlockSize() |
String |
getCommitPath() |
StorageDir |
getParentDir() |
String |
getPath() |
long |
getSessionId() |
void |
setBlockSize(long newSize) |
static String |
tempPath(StorageDir dir,
long sessionId,
long blockId)
All blocks are created as temp blocks before committed.
|
public DefaultTempBlockMeta(long sessionId, long blockId, long initialBlockSize, StorageDir dir)
DefaultTempBlockMeta
.sessionId
- the session idblockId
- the block idinitialBlockSize
- initial size of this block in bytesdir
- StorageDir
of this temp block belonging topublic static String tempPath(StorageDir dir, long sessionId, long blockId)
StorageDir
, the subdir is tmpFolder/sessionId % maxSubdirMax.
tmpFolder is a property of PropertyKey.WORKER_DATA_TMP_FOLDER
.
maxSubdirMax is a property of PropertyKey.WORKER_DATA_TMP_SUBDIR_MAX
.
The block file name is "sessionId-blockId". e.g. sessionId 2 creates a temp Block 100 in
StorageDir
"/mnt/mem/0", this temp block has path:
/mnt/mem/0/.tmp_blocks/2/2-100
dir
- the parent directorysessionId
- the session idblockId
- the block idpublic long getBlockSize()
getBlockSize
in interface TempBlockMeta
public String getPath()
getPath
in interface TempBlockMeta
public long getBlockId()
getBlockId
in interface TempBlockMeta
public BlockStoreLocation getBlockLocation()
getBlockLocation
in interface TempBlockMeta
public StorageDir getParentDir()
getParentDir
in interface TempBlockMeta
public String getCommitPath()
getCommitPath
in interface TempBlockMeta
public long getSessionId()
getSessionId
in interface TempBlockMeta
public void setBlockSize(long newSize)
setBlockSize
in interface TempBlockMeta
newSize
- block size to useCopyright © 2023. All Rights Reserved.