pub struct BlocksStateMachine {
pub forks: Forks<Slot>,
/* private fields */
}Expand description
Block State machine
This state machine is responsible for buffering blockstore events and provide a way to consume them in a controlled manner.
The entire blockstore state is logic is SANS-IO and must stay like this to ensure that we can test it properly.
IMPORTANT: SANS-IO means there is no IO operations in this state machine or async function that include channel communication.
Is to the developer to implement the IO part of the state machine by implementing your own “driver”.
Fields§
§forks: Forks<Slot>Maintain forks history of the blockchain.
Implementations§
Source§impl BlocksStateMachine
impl BlocksStateMachine
pub fn stats(&self) -> BlockstoreStats
pub fn is_slot_tracked(&self, slot: Slot) -> bool
Sourcepub fn process_replay_event(
&mut self,
event: BlockReplayEvent,
) -> Result<(), UntrackedSlot>
pub fn process_replay_event( &mut self, event: BlockReplayEvent, ) -> Result<(), UntrackedSlot>
Main entry point to process blockstore event and progress the state-machine.
Registers the event into the state machine and process any side effect that may arise from it.
pub fn process_consensus_event(&mut self, event: ConsensusUpdate)
Sourcepub fn oldest_block_in_buffer(&self) -> Option<OldestBufferedBlockInfo>
pub fn oldest_block_in_buffer(&self) -> Option<OldestBufferedBlockInfo>
Returns the oldest block in the buffer.
Sourcepub fn gc(&mut self, deleted: Option<&mut Vec<Slot>>) -> BlockstoreGCStats
pub fn gc(&mut self, deleted: Option<&mut Vec<Slot>>) -> BlockstoreGCStats
This function will clean out deprecated slot index information from the state machine making sure it does not grow forever.
Stuff to “deindex” are : metadata about slot that are finalized – Since they are finalized we don’t need to keep them around anymore. Forked Slot – Slot that are forked and we know we will never reach finalized status for them.
Sourcepub fn process_deregister_finalized_block_queue(&mut self)
pub fn process_deregister_finalized_block_queue(&mut self)
Process the deregistered slot from the queue.
Sourcepub fn pop_next_unprocess_blockstore_update(
&mut self,
) -> Option<BlockStateMachineOutput>
pub fn pop_next_unprocess_blockstore_update( &mut self, ) -> Option<BlockStateMachineOutput>
Pops the next unprocessed blockstore update from the queue.