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.
remove connected disconnected state only (#3868)
* remove connected disconnected state from overseer * foo * split new partial * fix * refactor init code to not require a `OverseerHandle` when we don't have an overseer * intermediate * fixins * X * fixup * foo * fixup * docs * conditional * Update node/service/src/lib.rs * review by ladi
- Loading branch information
Showing
17 changed files
with
548 additions
and
303 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 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/>. | ||
|
||
use crate::{AllMessages, OverseerSignal}; | ||
use polkadot_node_subsystem_types::errors::SubsystemError; | ||
use polkadot_overseer_gen::{FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext}; | ||
|
||
/// A dummy subsystem that implements [`Subsystem`] for all | ||
/// types of messages. Used for tests or as a placeholder. | ||
#[derive(Clone, Copy, Debug)] | ||
pub struct DummySubsystem; | ||
|
||
impl<Context> Subsystem<Context, SubsystemError> for DummySubsystem | ||
where | ||
Context: SubsystemContext< | ||
Signal = OverseerSignal, | ||
Error = SubsystemError, | ||
AllMessages = AllMessages, | ||
>, | ||
{ | ||
fn start(self, mut ctx: Context) -> SpawnedSubsystem<SubsystemError> { | ||
let future = Box::pin(async move { | ||
loop { | ||
match ctx.recv().await { | ||
Err(_) => return Ok(()), | ||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => return Ok(()), | ||
Ok(overseer_msg) => { | ||
tracing::debug!( | ||
target: "dummy-subsystem", | ||
"Discarding a message sent from overseer {:?}", | ||
overseer_msg | ||
); | ||
continue | ||
}, | ||
} | ||
} | ||
}); | ||
|
||
SpawnedSubsystem { name: "dummy-subsystem", future } | ||
} | ||
} |
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
Oops, something went wrong.