@NotThreadSafe public final class BlockMetadataManager extends Object
TieredBlockStore
, Allocator
and Evictor
.
All operations on block metadata such as StorageTier
, StorageDir
should go
through this class.
Modifier and Type | Field and Description |
---|---|
static StorageTierAssoc |
WORKER_STORAGE_TIER_ASSOC |
Modifier and Type | Method and Description |
---|---|
void |
abortTempBlockMeta(TempBlockMeta tempBlockMeta)
Aborts a temp block.
|
void |
addTempBlockMeta(TempBlockMeta tempBlockMeta)
Adds a temp block.
|
void |
cleanupSessionTempBlocks(long sessionId,
List<Long> tempBlockIds)
Deprecated.
As of version 0.8.
|
void |
commitTempBlockMeta(TempBlockMeta tempBlockMeta)
Commits a temp block.
|
static BlockMetadataManager |
createBlockMetadataManager()
Creates a new instance of
BlockMetadataManager . |
long |
getAvailableBytes(BlockStoreLocation location)
Gets the amount of available space of given location in bytes.
|
BlockIterator |
getBlockIterator() |
Optional<BlockMeta> |
getBlockMeta(long blockId)
Gets the metadata of a block given its block id.
|
BlockStoreMeta |
getBlockStoreMeta()
Gets a summary of the metadata.
|
BlockStoreMeta |
getBlockStoreMetaFull()
Gets a full summary of block store metadata.
|
StorageDir |
getDir(BlockStoreLocation location)
Gets the
StorageDir given its location in the store. |
List<TempBlockMeta> |
getSessionTempBlocks(long sessionId)
Gets all the temporary blocks associated with a session, empty list is returned if the session
has no temporary blocks.
|
StorageTierAssoc |
getStorageTierAssoc() |
Optional<TempBlockMeta> |
getTempBlockMeta(long blockId)
Gets the metadata of a temp block.
|
StorageTier |
getTier(String tierAlias)
Gets the
StorageTier given its tierAlias. |
List<StorageTier> |
getTiers()
Gets the list of
StorageTier managed. |
List<StorageTier> |
getTiersBelow(String tierAlias)
Gets the list of
StorageTier below the tier with the given tierAlias. |
boolean |
hasBlockMeta(long blockId)
Checks if the storage has a given block.
|
boolean |
hasTempBlockMeta(long blockId)
Checks if the storage has a given temp block.
|
BlockMeta |
moveBlockMeta(BlockMeta blockMeta,
TempBlockMeta tempBlockMeta)
Moves an existing block to another location currently hold by a temp block.
|
void |
removeBlockMeta(BlockMeta block)
Removes the metadata of a specific block.
|
void |
resizeTempBlockMeta(TempBlockMeta tempBlockMeta,
long newSize)
Modifies the size of a temp block.
|
public static final StorageTierAssoc WORKER_STORAGE_TIER_ASSOC
public BlockIterator getBlockIterator()
public static BlockMetadataManager createBlockMetadataManager()
BlockMetadataManager
.BlockMetadataManager
instancepublic void abortTempBlockMeta(TempBlockMeta tempBlockMeta)
tempBlockMeta
- the metadata of the temp block to addpublic void addTempBlockMeta(TempBlockMeta tempBlockMeta)
tempBlockMeta
- the metadata of the temp block to addpublic void commitTempBlockMeta(TempBlockMeta tempBlockMeta)
tempBlockMeta
- the metadata of the temp block to commit@Deprecated public void cleanupSessionTempBlocks(long sessionId, List<Long> tempBlockIds)
sessionId
- the id of the client associated with the temp blockstempBlockIds
- the list of temporary block ids to be cleaned up, non temporary block ids
will be ignored.public long getAvailableBytes(BlockStoreLocation location)
StorageDir
. Throws an IllegalArgumentException
when the location
does not belong to the tiered storage.location
- location the check available bytespublic Optional<BlockMeta> getBlockMeta(long blockId)
blockId
- the block idpublic BlockStoreMeta getBlockStoreMeta()
public BlockStoreMeta getBlockStoreMetaFull()
public StorageDir getDir(BlockStoreLocation location)
StorageDir
given its location in the store. Throws an
IllegalArgumentException
if the location is not a specific dir or the location is
invalid.location
- Location of the dirStorageDir
objectpublic Optional<TempBlockMeta> getTempBlockMeta(long blockId)
blockId
- the id of the temp blockpublic StorageTier getTier(String tierAlias)
StorageTier
given its tierAlias. Throws an IllegalArgumentException
if
the tierAlias is not found.tierAlias
- the alias of this tierStorageTier
object associated with the aliaspublic List<StorageTier> getTiers()
StorageTier
managed.StorageTier
spublic List<StorageTier> getTiersBelow(String tierAlias)
StorageTier
below the tier with the given tierAlias. Throws an
IllegalArgumentException
if the tierAlias is not found.tierAlias
- the alias of a tierStorageTier
public List<TempBlockMeta> getSessionTempBlocks(long sessionId)
sessionId
- the id of the sessionpublic boolean hasBlockMeta(long blockId)
blockId
- the block idpublic boolean hasTempBlockMeta(long blockId)
blockId
- the temp block idpublic BlockMeta moveBlockMeta(BlockMeta blockMeta, TempBlockMeta tempBlockMeta)
blockMeta
- the metadata of the block to movetempBlockMeta
- a placeholder in the destination directorypublic void removeBlockMeta(BlockMeta block)
block
- the metadata of the block to removepublic void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize)
tempBlockMeta
- the temp block to modifynewSize
- new size in bytespublic StorageTierAssoc getStorageTierAssoc()
Copyright © 2023. All Rights Reserved.