public interface StorageDir
Modifier and Type | Method and Description |
---|---|
void |
addBlockMeta(BlockMeta blockMeta)
Adds the metadata of a new block into this storage dir.
|
void |
addTempBlockMeta(TempBlockMeta tempBlockMeta)
Adds the metadata of a new block into this storage dir.
|
void |
cleanupSessionTempBlocks(long sessionId,
List<Long> tempBlockIds)
Cleans up the temp block metadata for each block id passed in.
|
long |
getAvailableBytes()
Gets the total available capacity of this
StorageDir in bytes. |
List<Long> |
getBlockIds()
Returns the list of block ids in this dir.
|
Optional<BlockMeta> |
getBlockMeta(long blockId)
Gets the
BlockMeta from this storage dir by its block id. |
List<BlockMeta> |
getBlocks()
Returns the list of blocks stored in this dir.
|
long |
getCapacityBytes()
Gets the total capacity of this
StorageDir in bytes, which is a constant once this
StorageDir has been initialized. |
long |
getCommittedBytes()
Gets the total size of committed blocks in this StorageDir in bytes.
|
int |
getDirIndex()
Returns the zero-based index of this dir in its parent
StorageTier . |
String |
getDirMedium() |
String |
getDirPath() |
StorageTier |
getParentTier()
Returns the
StorageTier containing this StorageDir . |
long |
getReservedBytes() |
List<TempBlockMeta> |
getSessionTempBlocks(long sessionId)
Gets the temporary blocks associated with a session in this
StorageDir , an empty list
is returned if the session has no temporary blocks in this StorageDir . |
Optional<TempBlockMeta> |
getTempBlockMeta(long blockId)
Gets the
TempBlockMeta from this storage dir by its block id. |
boolean |
hasBlockMeta(long blockId)
Checks if a block is in this storage dir.
|
boolean |
hasTempBlockMeta(long blockId)
Checks if a temp block is in this storage dir.
|
void |
removeBlockMeta(BlockMeta blockMeta)
Removes a block from this storage dir.
|
void |
removeTempBlockMeta(TempBlockMeta tempBlockMeta)
Removes a temp block from this storage dir.
|
void |
resizeTempBlockMeta(TempBlockMeta tempBlockMeta,
long newSize)
Changes the size of a temp block.
|
BlockStoreLocation |
toBlockStoreLocation() |
long getCapacityBytes()
StorageDir
in bytes, which is a constant once this
StorageDir
has been initialized.StorageDir
in byteslong getAvailableBytes()
StorageDir
in bytes. This value equals the
total capacity of this StorageDir
, minus the used bytes by committed blocks and temp
blocks.long getCommittedBytes()
String getDirPath()
String getDirMedium()
StorageTier getParentTier()
StorageTier
containing this StorageDir
.StorageTier
int getDirIndex()
StorageTier
.List<Long> getBlockIds()
List<BlockMeta> getBlocks()
boolean hasBlockMeta(long blockId)
blockId
- the block idboolean hasTempBlockMeta(long blockId)
blockId
- the block idOptional<BlockMeta> getBlockMeta(long blockId)
BlockMeta
from this storage dir by its block id.blockId
- the block idBlockMeta
of the given block or emptyOptional<TempBlockMeta> getTempBlockMeta(long blockId)
TempBlockMeta
from this storage dir by its block id.blockId
- the block idTempBlockMeta
of the given block or emptyvoid addBlockMeta(BlockMeta blockMeta)
blockMeta
- the metadata of the blockvoid addTempBlockMeta(TempBlockMeta tempBlockMeta)
tempBlockMeta
- the metadata of a temp block to addvoid removeBlockMeta(BlockMeta blockMeta)
blockMeta
- the metadata of the blockvoid removeTempBlockMeta(TempBlockMeta tempBlockMeta)
tempBlockMeta
- the metadata of the temp block to removevoid resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize)
tempBlockMeta
- the metadata of the temp block to resizenewSize
- the new size after change in bytesvoid cleanupSessionTempBlocks(long sessionId, List<Long> tempBlockIds)
sessionId
- the id of the client associated with the temporary blockstempBlockIds
- the list of temporary blocks to clean up, non temporary blocks or
nonexistent blocks will be ignoredList<TempBlockMeta> getSessionTempBlocks(long sessionId)
StorageDir
, an empty list
is returned if the session has no temporary blocks in this StorageDir
.sessionId
- the id of the sessionStorageDir
BlockStoreLocation toBlockStoreLocation()
long getReservedBytes()
Copyright © 2023. All Rights Reserved.