@NotThreadSafe @Deprecated public abstract class AbstractEvictor extends AbstractBlockStoreEventListener implements Evictor
Evictor.Factory, Evictor.Mode
Modifier and Type | Field and Description |
---|---|
protected Allocator |
mAllocator
Deprecated.
|
protected BlockMetadataEvictorView |
mMetadataView
Deprecated.
|
Constructor and Description |
---|
AbstractEvictor(BlockMetadataEvictorView view,
Allocator allocator)
Deprecated.
Creates a new instance of
AbstractEvictor . |
Modifier and Type | Method and Description |
---|---|
protected StorageDirEvictorView |
cascadingEvict(long bytesToBeAvailable,
BlockStoreLocation location,
EvictionPlan plan,
Evictor.Mode mode)
Deprecated.
A recursive implementation of cascading eviction.
|
EvictionPlan |
freeSpaceWithView(long bytesToBeAvailable,
BlockStoreLocation location,
BlockMetadataEvictorView view)
Deprecated.
Frees space with the guaranteed mode.
|
EvictionPlan |
freeSpaceWithView(long bytesToBeAvailable,
BlockStoreLocation location,
BlockMetadataEvictorView view,
Evictor.Mode mode)
Deprecated.
Frees space in the given block store location and with the given view.
|
protected abstract Iterator<Long> |
getBlockIterator()
Deprecated.
Returns an iterator for evictor cache blocks.
|
protected void |
onRemoveBlockFromIterator(long blockId)
Deprecated.
Performs additional cleanup when a block is removed from the iterator returned by
getBlockIterator() . |
onAbortBlock, onAccessBlock, onAccessBlock, onBlockLost, onCommitBlockToLocal, onCommitBlockToMaster, onMoveBlockByClient, onMoveBlockByWorker, onRemoveBlock, onRemoveBlockByClient, onRemoveBlockByWorker, onStorageLost, onStorageLost
protected final Allocator mAllocator
protected BlockMetadataEvictorView mMetadataView
public AbstractEvictor(BlockMetadataEvictorView view, Allocator allocator)
AbstractEvictor
.view
- a view of block metadata informationallocator
- an allocation policyprotected StorageDirEvictorView cascadingEvict(long bytesToBeAvailable, BlockStoreLocation location, EvictionPlan plan, Evictor.Mode mode)
StorageDir
in the location has
the specific amount of free space. It then uses an allocation strategy to allocate space in the
next tier to move each evicted blocks. If the next tier fails to allocate space for the evicted
blocks, the next tier will continue to evict its blocks to free space.
This method is only used in
freeSpaceWithView(long, BlockStoreLocation, BlockMetadataEvictorView)
.bytesToBeAvailable
- bytes to be available after evictionlocation
- target location to evict blocks fromplan
- the plan to be recursively updated, is empty when first called in
freeSpaceWithView(long, BlockStoreLocation, BlockMetadataEvictorView)
mode
- the eviction modeStorageDirEvictorView
in the range of location
to evict/move bytes from, or null if there is no planpublic EvictionPlan freeSpaceWithView(long bytesToBeAvailable, BlockStoreLocation location, BlockMetadataEvictorView view)
Evictor
freeSpaceWithView
in interface Evictor
bytesToBeAvailable
- the amount of free space in bytes to be ensured after evictionlocation
- the location in block storeview
- generated and passed by block storeEvictionPlan
(possibly with empty fields) to get the free space, or null
if no plan is feasiblepublic EvictionPlan freeSpaceWithView(long bytesToBeAvailable, BlockStoreLocation location, BlockMetadataEvictorView view, Evictor.Mode mode)
Evictor
StorageDir
in the location has the specific amount of free
space after eviction. The location can be a specific
StorageDir
, or BlockStoreLocation.anyTier()
or
BlockStoreLocation.anyDirInTier(String)
. The view is generated and passed by the
calling LocalBlockStore
. This method returns null if Evictor
fails to propose a feasible plan to meet the requirement.
With the BEST_EFFORT mode, the evictor always returns an eviction plan with toMove and toEvict fields to indicate how to free space. Even if the tier does not have the amount of free space, the evictor returns the plan to free the max space.
If both toMove and toEvict of the plan are empty, it indicates that Evictor
has no
actions to take and the requirement is already met.
Throws an IllegalArgumentException
if the given block location is invalid.
freeSpaceWithView
in interface Evictor
bytesToBeAvailable
- the amount of free space in bytes to be ensured after evictionlocation
- the location in block storeview
- generated and passed by block storemode
- the eviction modeEvictionPlan
(possibly with empty fields) to get the free space, or null
if no plan is feasibleprotected abstract Iterator<Long> getBlockIterator()
LRUEvictor
returns an iterator
that iterates through the block ids in LRU order.protected void onRemoveBlockFromIterator(long blockId)
getBlockIterator()
.Copyright © 2023. All Rights Reserved.