This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
establish new
node
folder for overseer, messages, and subsystems (#…
…1200) * establish new `node` folder for overseer, messages, and subsystems * extract message types from overseer crate * remove doc links
- Loading branch information
Showing
9 changed files
with
123 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Stub - This folder will hold core subsystem implementations, each with their own crate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "polkadot-node-messages" | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2018" | ||
description = "Message types used by Subsystems" | ||
|
||
[dependencies] | ||
polkadot-primitives = { path = "../../primitives" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright 2017-2020 Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Message types for the overseer and subsystems. | ||
//! | ||
//! These messages are intended to define the protocol by which different subsystems communicate with each | ||
//! other and signals that they receive from an overseer to coordinate their work. | ||
//! This is intended for use with the `polkadot-overseer` crate. | ||
//! | ||
//! Subsystems' APIs are defined separately from their implementation, leading to easier mocking. | ||
|
||
use polkadot_primitives::Hash; | ||
|
||
/// Signals sent by an overseer to a subsystem. | ||
#[derive(PartialEq, Clone, Debug)] | ||
pub enum OverseerSignal { | ||
/// `Subsystem` should start working on block-based work, given by the relay-chain block hash. | ||
StartWork(Hash), | ||
/// `Subsystem` should stop working on block-based work specified by the relay-chain block hash. | ||
StopWork(Hash), | ||
/// Conclude the work of the `Overseer` and all `Subsystem`s. | ||
Conclude, | ||
} | ||
|
||
/// A message type used by the Validation Subsystem. | ||
#[derive(Debug)] | ||
pub enum ValidationSubsystemMessage { | ||
ValidityAttestation, | ||
} | ||
|
||
/// A message type used by the CandidateBacking Subsystem. | ||
#[derive(Debug)] | ||
pub enum CandidateBackingSubsystemMessage { | ||
RegisterBackingWatcher, | ||
Second, | ||
} | ||
|
||
/// A message type tying together all message types that are used across Subsystems. | ||
#[derive(Debug)] | ||
pub enum AllMessages { | ||
Validation(ValidationSubsystemMessage), | ||
CandidateBacking(CandidateBackingSubsystemMessage), | ||
} | ||
|
||
/// A message type that a subsystem receives from an overseer. | ||
/// It wraps signals from an overseer and messages that are circulating | ||
/// between subsystems. | ||
/// | ||
/// It is generic over over the message type `M` that a particular `Subsystem` may use. | ||
#[derive(Debug)] | ||
pub enum FromOverseer<M: std::fmt::Debug> { | ||
/// Signal from the `Overseer`. | ||
Signal(OverseerSignal), | ||
|
||
/// Some other `Subsystem`'s message. | ||
Communication { | ||
msg: M, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Stub - This folder will hold networking subsystem implementations, each with their own crate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters