@ThreadSafe public abstract class AbstractBlockMeta extends Object
Modifier and Type | Field and Description |
---|---|
protected long |
mBlockId |
protected StorageDir |
mDir |
Constructor and Description |
---|
AbstractBlockMeta(long blockId,
StorageDir dir)
Creates a new instance of
AbstractBlockMeta . |
Modifier and Type | Method and Description |
---|---|
static String |
commitPath(StorageDir dir,
long blockId)
Committed block is stored in BlockStore under its
StorageDir as a block file named
after its blockId. |
long |
getBlockId() |
BlockStoreLocation |
getBlockLocation() |
abstract long |
getBlockSize() |
StorageDir |
getParentDir() |
abstract String |
getPath() |
static String |
tempPath(StorageDir dir,
long sessionId,
long blockId)
All blocks are created as temp blocks before committed.
|
protected final long mBlockId
protected final StorageDir mDir
public AbstractBlockMeta(long blockId, StorageDir dir)
AbstractBlockMeta
.blockId
- the block iddir
- the parent directorypublic 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 static String commitPath(StorageDir dir, long blockId)
StorageDir
as a block file named
after its blockId. e.g. Block 100 of StorageDir "/mnt/mem/0" has path:
/mnt/mem/0/100
blockId
- the block iddir
- the parent directorypublic long getBlockId()
public BlockStoreLocation getBlockLocation()
public StorageDir getParentDir()
public abstract String getPath()
public abstract long getBlockSize()
Copyright © 2023. All Rights Reserved.