mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
Integrate all (dummy) subsystems with the Overseer (#1374)
* overseer: introduce a utility typemap * it's ugly but it compiles * move DummySubsystem to subsystem crate * fix tests fallout * use a struct for all subsystems * more tests fallout * add missing pov_distribution subsystem * remove unused imports and bounds * fix minimal-example
This commit is contained in:
@@ -148,3 +148,21 @@ pub trait Subsystem<C: SubsystemContext> {
|
||||
/// Start this `Subsystem` and return `SpawnedSubsystem`.
|
||||
fn start(self, ctx: C) -> SpawnedSubsystem;
|
||||
}
|
||||
|
||||
/// A dummy subsystem that implements [`Subsystem`] for all
|
||||
/// types of messages. Used for tests or as a placeholder.
|
||||
pub struct DummySubsystem;
|
||||
|
||||
impl<C: SubsystemContext> Subsystem<C> for DummySubsystem {
|
||||
fn start(self, mut ctx: C) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
loop {
|
||||
match ctx.recv().await {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return,
|
||||
Err(_) => return,
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user