@NotThreadSafe public class BlockMetadataEvictorView extends BlockMetadataView
BlockMetadataManager
to Evictors,
filtering out un-evictable blocks and un-allocatable space internally, so that evictors and
allocators can be developed with much simpler logic, without worrying about various constraints,
e.g. pinned files, locked blocks, etc.
TODO(cc): Filter un-allocatable space.Constructor and Description |
---|
BlockMetadataEvictorView(BlockMetadataManager manager,
Set<Long> pinnedInodes,
Set<Long> lockedBlocks)
Creates a new instance of
BlockMetadataEvictorView . |
Modifier and Type | Method and Description |
---|---|
void |
clearBlockMarks()
Clears all marks of blocks to move in/out in all dir views.
|
long |
getAvailableBytes(BlockStoreLocation location)
Gets available bytes given certain location
BlockMetadataManager.getAvailableBytes(BlockStoreLocation) . |
BlockMeta |
getBlockMeta(long blockId)
Returns null if block is pinned or currently being locked, otherwise returns
BlockMetadataManager.getBlockMeta(long) . |
boolean |
isBlockEvictable(long blockId)
Tests if the block is evictable.
|
boolean |
isBlockLocked(long blockId)
Tests if the block is locked.
|
boolean |
isBlockMarked(long blockId)
Tests if the block is marked to move out of its current dir in this view.
|
boolean |
isBlockPinned(long blockId)
Tests if the block is pinned either explicitly or because it is scheduled for async persist.
|
getNextTier, getTierView, getTierViews, getTierViewsBelow
public BlockMetadataEvictorView(BlockMetadataManager manager, Set<Long> pinnedInodes, Set<Long> lockedBlocks)
BlockMetadataEvictorView
. Now we always create a new view
before freespace.manager
- which the view should be constructed frompinnedInodes
- a set of pinned inodeslockedBlocks
- a set of locked blockspublic void clearBlockMarks()
public boolean isBlockPinned(long blockId)
blockId
- to be testedpublic boolean isBlockLocked(long blockId)
blockId
- to be testedpublic boolean isBlockEvictable(long blockId)
blockId
- to be testedpublic boolean isBlockMarked(long blockId)
blockId
- the id of the blockpublic long getAvailableBytes(BlockStoreLocation location)
BlockMetadataManager.getAvailableBytes(BlockStoreLocation)
. Throws an
IllegalArgumentException
if the location does not belong to tiered storage.location
- location the check available bytes@Nullable public BlockMeta getBlockMeta(long blockId) throws BlockDoesNotExistException
BlockMetadataManager.getBlockMeta(long)
.blockId
- the block idBlockDoesNotExistException
- if no BlockMeta
for this block id is foundCopyright © 2023. All Rights Reserved.