mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
overseer becomes orchestra (#5542)
* rename overseer-gen to orchestra Also drop `gum` and use `tracing`. * make orchestra compile as standalone * introduce Spawner trait to split from sp_core Finalizes the independence of orchestra from polkadot-overseer * slip of the pen * other fixins * remove unused import * Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> * Update node/overseer/orchestra/proc-macro/src/impl_builder.rs Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> * orchestra everywhere * leaky data * Bump scale-info from 2.1.1 to 2.1.2 (#5552) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/compare/v2.1.1...v2.1.2) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add missing markdown code block delimiter (#5555) * bitfield-signing: remove util::jobs usage (#5523) * Switch to pooling copy-on-write instantiation strategy for WASM (companion for Substrate#11232) (#5337) * Switch to pooling copy-on-write instantiation strategy for WASM * Fix compilation of `polkadot-test-service` * Update comments * Move `max_memory_size` to `Semantics` * Rename `WasmInstantiationStrategy` to `WasmtimeInstantiationStrategy` * Update a safety comment * update lockfile for {"substrate"} Co-authored-by: parity-processbot <> * Fix build Co-authored-by: Vsevolod Stakhov <vsevolod.stakhov@parity.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Malte Kliemann <mail@maltekliemann.com> Co-authored-by: Chris Sosnin <48099298+slumber@users.noreply.github.com> Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d9eff4ecd4
commit
450ca2baca
@@ -19,14 +19,14 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use polkadot_node_subsystem::{
|
||||
messages::AllMessages, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
messages::AllMessages, overseer, FromOrchestra, OverseerSignal, SpawnGlue, SpawnedSubsystem,
|
||||
SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
|
||||
use futures::{channel::mpsc, poll, prelude::*};
|
||||
use parking_lot::Mutex;
|
||||
use sp_core::{testing::TaskExecutor, traits::SpawnNamed};
|
||||
use sp_core::testing::TaskExecutor;
|
||||
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
@@ -176,7 +176,7 @@ where
|
||||
/// A test subsystem context.
|
||||
pub struct TestSubsystemContext<M, S> {
|
||||
tx: TestSubsystemSender,
|
||||
rx: SingleItemStream<FromOverseer<M>>,
|
||||
rx: SingleItemStream<FromOrchestra<M>>,
|
||||
spawn: S,
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ where
|
||||
M: overseer::AssociateOutgoing + std::fmt::Debug + Send + 'static,
|
||||
AllMessages: From<<M as overseer::AssociateOutgoing>::OutgoingMessages>,
|
||||
AllMessages: From<M>,
|
||||
Spawner: SpawnNamed + Send + 'static,
|
||||
Spawner: overseer::gen::Spawner + Send + 'static,
|
||||
{
|
||||
type Message = M;
|
||||
type Sender = TestSubsystemSender;
|
||||
@@ -194,7 +194,7 @@ where
|
||||
type OutgoingMessages = <M as overseer::AssociateOutgoing>::OutgoingMessages;
|
||||
type Error = SubsystemError;
|
||||
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOverseer<M>>, ()> {
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOrchestra<M>>, ()> {
|
||||
match poll!(self.rx.next()) {
|
||||
Poll::Ready(Some(msg)) => Ok(Some(msg)),
|
||||
Poll::Ready(None) => Err(()),
|
||||
@@ -202,7 +202,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
async fn recv(&mut self) -> SubsystemResult<FromOverseer<M>> {
|
||||
async fn recv(&mut self) -> SubsystemResult<FromOrchestra<M>> {
|
||||
self.rx
|
||||
.next()
|
||||
.await
|
||||
@@ -238,7 +238,7 @@ pub struct TestSubsystemContextHandle<M> {
|
||||
///
|
||||
/// Useful for shared ownership situations (one can have multiple senders, but only one
|
||||
/// receiver.
|
||||
pub tx: SingleItemSink<FromOverseer<M>>,
|
||||
pub tx: SingleItemSink<FromOrchestra<M>>,
|
||||
|
||||
/// Direct access to the receiver.
|
||||
pub rx: mpsc::UnboundedReceiver<AllMessages>,
|
||||
@@ -247,7 +247,7 @@ pub struct TestSubsystemContextHandle<M> {
|
||||
impl<M> TestSubsystemContextHandle<M> {
|
||||
/// Send a message or signal to the subsystem. This resolves at the point in time when the
|
||||
/// subsystem has _read_ the message.
|
||||
pub async fn send(&mut self, from_overseer: FromOverseer<M>) {
|
||||
pub async fn send(&mut self, from_overseer: FromOrchestra<M>) {
|
||||
self.tx.send(from_overseer).await.expect("Test subsystem no longer live");
|
||||
}
|
||||
|
||||
@@ -264,8 +264,8 @@ impl<M> TestSubsystemContextHandle<M> {
|
||||
|
||||
/// Make a test subsystem context.
|
||||
pub fn make_subsystem_context<M, S>(
|
||||
spawn: S,
|
||||
) -> (TestSubsystemContext<M, S>, TestSubsystemContextHandle<M>) {
|
||||
spawner: S,
|
||||
) -> (TestSubsystemContext<M, SpawnGlue<S>>, TestSubsystemContextHandle<M>) {
|
||||
let (overseer_tx, overseer_rx) = single_item_sink();
|
||||
let (all_messages_tx, all_messages_rx) = mpsc::unbounded();
|
||||
|
||||
@@ -273,7 +273,7 @@ pub fn make_subsystem_context<M, S>(
|
||||
TestSubsystemContext {
|
||||
tx: TestSubsystemSender { tx: all_messages_tx },
|
||||
rx: overseer_rx,
|
||||
spawn,
|
||||
spawn: SpawnGlue(spawner),
|
||||
},
|
||||
TestSubsystemContextHandle { tx: overseer_tx, rx: all_messages_rx },
|
||||
)
|
||||
@@ -290,7 +290,7 @@ pub fn subsystem_test_harness<M, OverseerFactory, Overseer, TestFactory, Test>(
|
||||
) where
|
||||
OverseerFactory: FnOnce(TestSubsystemContextHandle<M>) -> Overseer,
|
||||
Overseer: Future<Output = ()>,
|
||||
TestFactory: FnOnce(TestSubsystemContext<M, TaskExecutor>) -> Test,
|
||||
TestFactory: FnOnce(TestSubsystemContext<M, overseer::SpawnGlue<TaskExecutor>>) -> Test,
|
||||
Test: Future<Output = ()>,
|
||||
{
|
||||
let pool = TaskExecutor::new();
|
||||
@@ -330,8 +330,8 @@ where
|
||||
let future = Box::pin(async move {
|
||||
loop {
|
||||
match ctx.recv().await {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()),
|
||||
Ok(FromOverseer::Communication { msg }) => {
|
||||
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => return Ok(()),
|
||||
Ok(FromOrchestra::Communication { msg }) => {
|
||||
let _ = self.0.send(msg).await;
|
||||
},
|
||||
Err(_) => return Ok(()),
|
||||
@@ -381,6 +381,7 @@ mod tests {
|
||||
use polkadot_node_subsystem::messages::CollatorProtocolMessage;
|
||||
use polkadot_overseer::{dummy::dummy_overseer_builder, Handle, HeadSupportsParachains};
|
||||
use polkadot_primitives::v2::Hash;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
struct AlwaysSupportsParachains;
|
||||
impl HeadSupportsParachains for AlwaysSupportsParachains {
|
||||
|
||||
Reference in New Issue
Block a user