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:
Andronik Ordian authored and GitHub committed 2020-07-09 16:25:40 -04:00
1 parent c119627835
commit 6957847b6b
5 files changed
+425 -106

No files matched your search

+18
View File
@@ -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,
}
}
}))
}
}
+6 -6
View File
@@ -246,12 +246,12 @@ pub enum PoVDistributionMessage {
///
/// This `CandidateDescriptor` should correspond to a candidate seconded under the provided
/// relay-parent hash.
FetchPoV(Hash, CandidateDescriptor, oneshot::Sender<Arc<PoVBlock>>),
/// Distribute a PoV for the given relay-parent and CandidateDescriptor.
/// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor
DistributePoV(Hash, CandidateDescriptor, Arc<PoVBlock>),
/// An update from the network bridge.
NetworkBridgeUpdate(NetworkBridgeEvent),
FetchPoV(Hash, CandidateDescriptor, oneshot::Sender<Arc<PoVBlock>>),
/// Distribute a PoV for the given relay-parent and CandidateDescriptor.
/// The PoV should correctly hash to the PoV hash mentioned in the CandidateDescriptor
DistributePoV(Hash, CandidateDescriptor, Arc<PoVBlock>),
/// An update from the network bridge.
NetworkBridgeUpdate(NetworkBridgeEvent),
}
/// A message type tying together all message types that are used across Subsystems.