Struct phron_finality::data_io::data_store::DataStore
source · pub struct DataStore<B, C, RB, Message, R>where
B: BlockT<Hash = BlockHash>,
B::Header: HeaderT<Number = BlockNumber>,
C: HeaderBackend<B> + BlockchainEvents<B> + Send + Sync + 'static,
RB: RequestBlocks + 'static,
Message: PhronNetworkMessage + Debug + Send + Sync + Clone + Codec + 'static,
R: Receiver<Message>,{Show 14 fields
next_free_id: u64,
pending_proposals: HashMap<PhronProposal, PendingProposalInfo>,
event_triggers: HashMap<ChainEvent, HashSet<PhronProposal>>,
pending_messages: BTreeMap<u64, PendingMessageInfo<Message>>,
chain_info_provider: CachedChainInfoProvider<SubstrateChainInfoProvider<B, C>>,
available_proposals_cache: LruCache<PhronProposal, ProposalStatus>,
num_triggers_registered_since_last_pruning: usize,
highest_finalized_num: BlockNumber,
session_boundaries: SessionBoundaries,
client: Arc<C>,
block_requester: RB,
config: DataStoreConfig,
messages_from_network: R,
messages_for_phron: UnboundedSender<Message>,
}
Expand description
This component is used for filtering available data for Phron Network. It needs to be started by calling the run method.
Fields§
§next_free_id: u64
§pending_proposals: HashMap<PhronProposal, PendingProposalInfo>
§event_triggers: HashMap<ChainEvent, HashSet<PhronProposal>>
§pending_messages: BTreeMap<u64, PendingMessageInfo<Message>>
§chain_info_provider: CachedChainInfoProvider<SubstrateChainInfoProvider<B, C>>
§available_proposals_cache: LruCache<PhronProposal, ProposalStatus>
§num_triggers_registered_since_last_pruning: usize
§highest_finalized_num: BlockNumber
§session_boundaries: SessionBoundaries
§client: Arc<C>
§block_requester: RB
§config: DataStoreConfig
§messages_from_network: R
§messages_for_phron: UnboundedSender<Message>
Implementations§
source§impl<B, C, RB, Message, R> DataStore<B, C, RB, Message, R>where
B: BlockT<Hash = BlockHash>,
B::Header: HeaderT<Number = BlockNumber>,
C: HeaderBackend<B> + BlockchainEvents<B> + Send + Sync + 'static,
RB: RequestBlocks + 'static,
Message: PhronNetworkMessage + Debug + Send + Sync + Clone + Codec + 'static,
R: Receiver<Message>,
impl<B, C, RB, Message, R> DataStore<B, C, RB, Message, R>where
B: BlockT<Hash = BlockHash>,
B::Header: HeaderT<Number = BlockNumber>,
C: HeaderBackend<B> + BlockchainEvents<B> + Send + Sync + 'static,
RB: RequestBlocks + 'static,
Message: PhronNetworkMessage + Debug + Send + Sync + Clone + Codec + 'static,
R: Receiver<Message>,
sourcepub fn new<N: ComponentNetwork<Message, R = R>>(
session_boundaries: SessionBoundaries,
client: Arc<C>,
block_requester: RB,
config: DataStoreConfig,
component_network: N
) -> (Self, impl DataNetwork<Message>)
pub fn new<N: ComponentNetwork<Message, R = R>>( session_boundaries: SessionBoundaries, client: Arc<C>, block_requester: RB, config: DataStoreConfig, component_network: N ) -> (Self, impl DataNetwork<Message>)
Returns a struct to be run and a network that outputs messages filtered as appropriate
pub async fn run(&mut self, exit: Receiver<()>)
fn update_highest_finalized(&mut self)
fn run_maintenance(&mut self)
fn register_block_import_trigger( &mut self, proposal: &PhronProposal, block: &BlockId )
fn register_finality_trigger( &mut self, proposal: &PhronProposal, number: BlockNumber )
fn register_next_finality_trigger(&mut self, proposal: &PhronProposal)
fn on_block_finalized(&mut self, block: BlockId)
fn on_block_imported(&mut self, block: BlockId)
fn on_proposal_available(&mut self, proposal: &PhronProposal)
fn bump_proposal(&mut self, proposal: &PhronProposal) -> bool
fn check_proposal_availability( &mut self, proposal: &PhronProposal, old_status: Option<&ProposalStatus> ) -> ProposalStatus
fn add_message_proposal_dependency( &mut self, proposal: &PhronProposal, message_info: &mut PendingMessageInfo<Message>, id: u64 )
fn on_message_dependencies_resolved(&self, message: Message)
fn assign_fresh_message_id(&mut self) -> u64
fn remove_proposal_from_pending_message( &mut self, proposal: &PhronProposal, id: u64 )
fn remove_message_id_from_pending_proposal( &mut self, proposal: &PhronProposal, id: u64 )
fn prune_single_message(&mut self) -> bool
fn prune_pending_messages(&mut self)
fn prune_triggers(&mut self)
fn on_message_received(&mut self, message: Message)
Trait Implementations§
source§impl<B, C, RB, Message, R> Runnable for DataStore<B, C, RB, Message, R>where
B: BlockT<Hash = BlockHash>,
B::Header: HeaderT<Number = BlockNumber>,
C: HeaderBackend<B> + BlockchainEvents<B> + Send + Sync + 'static,
RB: RequestBlocks + 'static,
Message: PhronNetworkMessage + Debug + Send + Sync + Clone + Codec + 'static,
R: Receiver<Message> + 'static,
impl<B, C, RB, Message, R> Runnable for DataStore<B, C, RB, Message, R>where
B: BlockT<Hash = BlockHash>,
B::Header: HeaderT<Number = BlockNumber>,
C: HeaderBackend<B> + BlockchainEvents<B> + Send + Sync + 'static,
RB: RequestBlocks + 'static,
Message: PhronNetworkMessage + Debug + Send + Sync + Clone + Codec + 'static,
R: Receiver<Message> + 'static,
Auto Trait Implementations§
impl<B, C, RB, Message, R> !RefUnwindSafe for DataStore<B, C, RB, Message, R>
impl<B, C, RB, Message, R> Send for DataStore<B, C, RB, Message, R>
impl<B, C, RB, Message, R> Sync for DataStore<B, C, RB, Message, R>
impl<B, C, RB, Message, R> Unpin for DataStore<B, C, RB, Message, R>
impl<B, C, RB, Message, R> !UnwindSafe for DataStore<B, C, RB, Message, R>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.