Struct phron_finality::sync::service::Service
source · pub struct Service<B, J, N, CE, CS, V, F, BI>where
J: Justification,
B: Block<UnverifiedHeader = <<J as Justification>::Header as Header>::Unverified>,
N: GossipNetwork<VersionedNetworkData<B, J>>,
CE: ChainStatusNotifier<J::Header>,
CS: ChainStatus<B, J>,
V: Verifier<J>,
F: Finalizer<J>,
BI: BlockImport<B>,{
network: VersionWrapper<B, J, N>,
handler: Handler<B, N::PeerId, J, CS, V, F, BI>,
tasks: TaskQueue<RequestTask>,
broadcast_ticker: Ticker,
chain_extension_ticker: Ticker,
chain_events: CE,
justifications_from_user: UnboundedReceiver<J::Unverified>,
additional_justifications_from_user: UnboundedReceiver<J::Unverified>,
block_requests_from_user: UnboundedReceiver<BlockId>,
blocks_from_creator: UnboundedReceiver<B>,
metrics: Metrics,
}
Expand description
A service synchronizing the knowledge about the chain between the nodes.
Fields§
§network: VersionWrapper<B, J, N>
§handler: Handler<B, N::PeerId, J, CS, V, F, BI>
§tasks: TaskQueue<RequestTask>
§broadcast_ticker: Ticker
§chain_extension_ticker: Ticker
§chain_events: CE
§justifications_from_user: UnboundedReceiver<J::Unverified>
§additional_justifications_from_user: UnboundedReceiver<J::Unverified>
§block_requests_from_user: UnboundedReceiver<BlockId>
§blocks_from_creator: UnboundedReceiver<B>
§metrics: Metrics
Implementations§
source§impl<B, J, N, CE, CS, V, F, BI> Service<B, J, N, CE, CS, V, F, BI>where
J: Justification,
B: Block<UnverifiedHeader = <<J as Justification>::Header as Header>::Unverified>,
N: GossipNetwork<VersionedNetworkData<B, J>>,
CE: ChainStatusNotifier<J::Header>,
CS: ChainStatus<B, J>,
V: Verifier<J>,
F: Finalizer<J>,
BI: BlockImport<B>,
impl<B, J, N, CE, CS, V, F, BI> Service<B, J, N, CE, CS, V, F, BI>where
J: Justification,
B: Block<UnverifiedHeader = <<J as Justification>::Header as Header>::Unverified>,
N: GossipNetwork<VersionedNetworkData<B, J>>,
CE: ChainStatusNotifier<J::Header>,
CS: ChainStatus<B, J>,
V: Verifier<J>,
F: Finalizer<J>,
BI: BlockImport<B>,
sourcepub fn new(
verifier: V,
session_info: SessionBoundaryInfo,
io: IO<B, J, N, CE, CS, F, BI>,
metrics_registry: Option<Registry>
) -> Result<(Self, impl JustificationSubmissions<J> + Clone, impl RequestBlocks), HandlerError<B, J, CS, V, F>>
pub fn new( verifier: V, session_info: SessionBoundaryInfo, io: IO<B, J, N, CE, CS, F, BI>, metrics_registry: Option<Registry> ) -> Result<(Self, impl JustificationSubmissions<J> + Clone, impl RequestBlocks), HandlerError<B, J, CS, V, F>>
Create a new service using the provided network for communication. Also returns an interface for submitting additional justifications, and an interface for requesting blocks.
fn request_block(&mut self, block_id: BlockId)
fn broadcast(&mut self)
fn request_favourite_extension(&mut self, know_most: HashSet<N::PeerId>)
fn request_chain_extension(&mut self, force: bool)
fn try_request_chain_extension(&mut self)
fn send_request(&mut self, pre_request: PreRequest<N::PeerId>)
fn send_to(&mut self, data: NetworkData<B, J>, peer: N::PeerId)
fn handle_state(&mut self, state: State<J>, peer: N::PeerId)
fn handle_state_response( &mut self, justification: J::Unverified, maybe_justification: Option<J::Unverified>, peer: N::PeerId )
fn handle_justification_from_user(&mut self, justification: J::Unverified)
fn handle_request_response( &mut self, response_items: Vec<ResponseItem<B, J>>, peer: N::PeerId )
fn send_big_response( &mut self, response_items: &[ResponseItem<B, J>], peer: N::PeerId ) -> Result<(), MsgLimiterError>
fn handle_request(&mut self, request: Request<J>, peer: N::PeerId)
fn handle_task(&mut self, task: RequestTask)
fn handle_chain_event(&mut self, event: ChainStatusNotification<J::Header>)
fn handle_internal_request(&mut self, id: BlockId)
fn handle_chain_extension_request(&mut self, state: State<J>, peer: N::PeerId)
fn handle_network_data(&mut self, data: NetworkData<B, J>, peer: N::PeerId)
fn handle_own_block(&mut self, block: B)
Auto Trait Implementations§
impl<B, J, N, CE, CS, V, F, BI> !RefUnwindSafe for Service<B, J, N, CE, CS, V, F, BI>
impl<B, J, N, CE, CS, V, F, BI> Send for Service<B, J, N, CE, CS, V, F, BI>
impl<B, J, N, CE, CS, V, F, BI> Sync for Service<B, J, N, CE, CS, V, F, BI>
impl<B, J, N, CE, CS, V, F, BI> Unpin for Service<B, J, N, CE, CS, V, F, BI>
impl<B, J, N, CE, CS, V, F, BI> !UnwindSafe for Service<B, J, N, CE, CS, V, F, BI>
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
.