-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Migrate to new SEDA-based sources (#481)
- Loading branch information
Showing
15 changed files
with
823 additions
and
1,180 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,55 @@ | ||
mod common; | ||
use gasket::messaging::OutputPort; | ||
use serde::Deserialize; | ||
|
||
use crate::{bootstrap, crosscut, model, storage}; | ||
|
||
#[cfg(target_family = "unix")] | ||
pub mod n2c; | ||
|
||
pub mod n2n; | ||
pub mod utils; | ||
|
||
#[derive(Deserialize)] | ||
#[serde(tag = "type")] | ||
pub enum Config { | ||
N2N(n2n::Config), | ||
|
||
#[cfg(target_family = "unix")] | ||
N2C(n2c::Config), | ||
} | ||
|
||
impl Config { | ||
pub fn bootstrapper( | ||
self, | ||
chain: &crosscut::ChainWellKnownInfo, | ||
intersect: &crosscut::IntersectConfig, | ||
finalize: &Option<crosscut::FinalizeConfig>, | ||
policy: &crosscut::policies::RuntimePolicy, | ||
) -> Bootstrapper { | ||
match self { | ||
Config::N2N(c) => Bootstrapper::N2N(c.bootstrapper(chain, intersect, finalize, policy)), | ||
Config::N2C(c) => Bootstrapper::N2C(c.bootstrapper(chain, intersect, finalize, policy)), | ||
} | ||
} | ||
} | ||
|
||
pub enum Bootstrapper { | ||
N2N(n2n::Bootstrapper), | ||
N2C(n2c::Bootstrapper), | ||
} | ||
|
||
impl Bootstrapper { | ||
pub fn borrow_output_port(&mut self) -> &'_ mut OutputPort<model::RawBlockPayload> { | ||
match self { | ||
Bootstrapper::N2N(p) => p.borrow_output_port(), | ||
Bootstrapper::N2C(p) => p.borrow_output_port(), | ||
} | ||
} | ||
|
||
pub use common::*; | ||
pub fn spawn_stages(self, pipeline: &mut bootstrap::Pipeline, cursor: storage::Cursor) { | ||
match self { | ||
Bootstrapper::N2N(p) => p.spawn_stages(pipeline, cursor), | ||
Bootstrapper::N2C(p) => p.spawn_stages(pipeline, cursor), | ||
} | ||
} | ||
} |
Oops, something went wrong.