pub struct ImmutableBlock<T: BlockMetadata> { /* private fields */ }Expand description
RAII guard for a block in the Registered state.
An ImmutableBlock is the primary handle through which callers interact
with registered blocks. It is reference-counted (Clone-able) and each
clone independently tracks the inflight_immutable metric gauge, so the
gauge reflects the total number of outstanding references across the
system.
§Obtaining an ImmutableBlock
BlockManager::register_block– registers aCompleteBlockand returns anImmutableBlock.BlockManager::match_blocks/BlockManager::scan_matches– look up already-registered blocks bySequenceHash.WeakBlock::upgrade– resurrects a weak reference if the block is still alive.
§State transitions
§Clone behaviour
Cloning an ImmutableBlock increments inflight_immutable; dropping a
clone decrements it. The underlying registered block is shared via
Arc, so clones are cheap.
§Drop behaviour
Dropping the last strong reference (including internal pool references)
triggers the block’s return to the inactive or reset pool. Every drop
decrements the inflight_immutable gauge.
Implementations§
Source§impl<T: BlockMetadata> ImmutableBlock<T>
impl<T: BlockMetadata> ImmutableBlock<T>
Sourcepub fn downgrade(&self) -> WeakBlock<T>
pub fn downgrade(&self) -> WeakBlock<T>
Creates a WeakBlock that references the same registered block
without preventing it from being evicted.
Sourcepub fn sequence_hash(&self) -> SequenceHash
pub fn sequence_hash(&self) -> SequenceHash
Returns the SequenceHash that identifies this block’s content.
Sourcepub fn registration_handle(&self) -> BlockRegistrationHandle
pub fn registration_handle(&self) -> BlockRegistrationHandle
Returns a clone of the BlockRegistrationHandle for this block.