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.
|
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 . |
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 idBlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException
BlockMeta
from this storage dir by its block id.blockId
- the block idBlockMeta
of the given block or nullBlockDoesNotExistException
- if no block is foundTempBlockMeta getTempBlockMeta(long blockId)
TempBlockMeta
from this storage dir by its block id.blockId
- the block idTempBlockMeta
of the given block or nullvoid addBlockMeta(BlockMeta blockMeta) throws WorkerOutOfSpaceException, BlockAlreadyExistsException
blockMeta
- the metadata of the blockBlockAlreadyExistsException
- if blockId already existsWorkerOutOfSpaceException
- when not enough space to hold blockvoid addTempBlockMeta(TempBlockMeta tempBlockMeta) throws WorkerOutOfSpaceException, BlockAlreadyExistsException
tempBlockMeta
- the metadata of a temp block to addBlockAlreadyExistsException
- if blockId already existsWorkerOutOfSpaceException
- when not enough space to hold blockvoid removeBlockMeta(BlockMeta blockMeta) throws BlockDoesNotExistException
blockMeta
- the metadata of the blockBlockDoesNotExistException
- if no block is foundvoid removeTempBlockMeta(TempBlockMeta tempBlockMeta) throws BlockDoesNotExistException
tempBlockMeta
- the metadata of the temp block to removeBlockDoesNotExistException
- if no temp block is foundvoid resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException
tempBlockMeta
- the metadata of the temp block to resizenewSize
- the new size after change in bytesInvalidWorkerStateException
- when newSize is smaller than oldSizevoid 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.