mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 17:21:08 +00:00
refactor overseer into proc-macro based pattern (#2962)
This commit is contained in:
committed by
GitHub
parent
2510bfc5d7
commit
3c9104daff
@@ -27,7 +27,7 @@ use {
|
||||
polkadot_primitives::v1::{Hash, Block as PolkadotBlock, Header as PolkadotHeader},
|
||||
polkadot_subsystem::messages::ApprovalVotingMessage,
|
||||
prometheus_endpoint::{self, Registry},
|
||||
polkadot_overseer::OverseerHandler,
|
||||
polkadot_overseer::Handle,
|
||||
futures::channel::oneshot,
|
||||
};
|
||||
|
||||
@@ -41,13 +41,13 @@ use {
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct ApprovalCheckingVotingRule {
|
||||
checking_lag: Option<prometheus_endpoint::Gauge<prometheus_endpoint::U64>>,
|
||||
overseer: OverseerHandler,
|
||||
overseer: Handle,
|
||||
}
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
impl ApprovalCheckingVotingRule {
|
||||
/// Create a new approval checking diagnostic voting rule.
|
||||
pub fn new(overseer: OverseerHandler, registry: Option<&Registry>)
|
||||
pub fn new(overseer: Handle, registry: Option<&Registry>)
|
||||
-> Result<Self, prometheus_endpoint::PrometheusError>
|
||||
{
|
||||
Ok(ApprovalCheckingVotingRule {
|
||||
|
||||
@@ -56,7 +56,7 @@ pub use {
|
||||
sp_authority_discovery::AuthorityDiscoveryApi,
|
||||
sc_client_api::AuxStore,
|
||||
polkadot_primitives::v1::ParachainHost,
|
||||
polkadot_overseer::{Overseer, OverseerHandler},
|
||||
polkadot_overseer::{Overseer, Handle},
|
||||
};
|
||||
pub use sp_core::traits::SpawnNamed;
|
||||
|
||||
@@ -427,7 +427,7 @@ fn new_partial<RuntimeApi, Executor>(
|
||||
pub struct NewFull<C> {
|
||||
pub task_manager: TaskManager,
|
||||
pub client: C,
|
||||
pub overseer_handler: Option<OverseerHandler>,
|
||||
pub overseer_handler: Option<Handle>,
|
||||
pub network: Arc<sc_network::NetworkService<Block, <Block as BlockT>::Hash>>,
|
||||
pub rpc_handlers: RpcHandlers,
|
||||
pub backend: Arc<FullBackend>,
|
||||
|
||||
@@ -28,7 +28,7 @@ use polkadot_network_bridge::RequestMultiplexer;
|
||||
use polkadot_node_core_av_store::Config as AvailabilityConfig;
|
||||
use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig;
|
||||
use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig;
|
||||
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandler};
|
||||
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, Handle};
|
||||
use polkadot_primitives::v1::ParachainHost;
|
||||
use sc_authority_discovery::Service as AuthorityDiscoveryService;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
@@ -237,7 +237,7 @@ where
|
||||
/// would do.
|
||||
pub trait OverseerGen {
|
||||
/// Overwrite the full generation of the overseer, including the subsystems.
|
||||
fn generate<'a, Spawner, RuntimeClient>(&self, args: OverseerGenArgs<'a, Spawner, RuntimeClient>) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandler), Error>
|
||||
fn generate<'a, Spawner, RuntimeClient>(&self, args: OverseerGenArgs<'a, Spawner, RuntimeClient>) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, Handle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
@@ -256,7 +256,7 @@ pub struct RealOverseerGen;
|
||||
impl OverseerGen for RealOverseerGen {
|
||||
fn generate<'a, Spawner, RuntimeClient>(&self,
|
||||
args : OverseerGenArgs<'a, Spawner, RuntimeClient>
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandler), Error>
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, Handle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
|
||||
@@ -41,7 +41,7 @@ use {
|
||||
},
|
||||
polkadot_subsystem::messages::{ApprovalVotingMessage, ChainSelectionMessage},
|
||||
polkadot_node_subsystem_util::metrics::{self, prometheus},
|
||||
polkadot_overseer::OverseerHandler,
|
||||
polkadot_overseer::Handle,
|
||||
futures::channel::oneshot,
|
||||
consensus_common::{Error as ConsensusError, SelectChain},
|
||||
sp_blockchain::HeaderBackend,
|
||||
@@ -111,7 +111,7 @@ impl Metrics {
|
||||
/// A chain-selection implementation which provides safety for relay chains.
|
||||
pub struct SelectRelayChain<B> {
|
||||
backend: Arc<B>,
|
||||
overseer: OverseerHandler,
|
||||
overseer: Handle,
|
||||
// A fallback to use in case the overseer is disconnected.
|
||||
//
|
||||
// This is used on relay chains which have not yet enabled
|
||||
@@ -126,7 +126,7 @@ impl<B> SelectRelayChain<B>
|
||||
/// Create a new [`SelectRelayChain`] wrapping the given chain backend
|
||||
/// and a handle to the overseer.
|
||||
#[allow(unused)]
|
||||
pub fn new(backend: Arc<B>, overseer: OverseerHandler, metrics: Metrics) -> Self {
|
||||
pub fn new(backend: Arc<B>, overseer: Handle, metrics: Metrics) -> Self {
|
||||
SelectRelayChain {
|
||||
fallback: sc_consensus::LongestChain::new(backend.clone()),
|
||||
backend,
|
||||
@@ -172,7 +172,7 @@ impl<B> SelectRelayChain<B> {
|
||||
#[allow(unused)]
|
||||
pub fn connect_overseer_handler(
|
||||
&mut self,
|
||||
other_handler: &OverseerHandler,
|
||||
other_handler: &Handle,
|
||||
) {
|
||||
other_handler.connect_other(&mut self.overseer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user