mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
docs: mermaid diagram for pipeline (#67)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2197,6 +2197,7 @@ dependencies = [
|
|||||||
name = "reth-stages"
|
name = "reth-stages"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"aquamarine",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
|
|||||||
@ -15,6 +15,7 @@ thiserror = "1.0.37"
|
|||||||
tracing = "0.1.36"
|
tracing = "0.1.36"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
tokio = { version = "1.21.2", features = ["sync"] }
|
tokio = { version = "1.21.2", features = ["sync"] }
|
||||||
|
aquamarine = "0.1.12"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "*", features = ["rt", "sync", "macros"] }
|
tokio = { version = "*", features = ["rt", "sync", "macros"] }
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use ctrl::*;
|
|||||||
pub use event::*;
|
pub use event::*;
|
||||||
use state::*;
|
use state::*;
|
||||||
|
|
||||||
|
#[cfg_attr(doc, aquamarine::aquamarine)]
|
||||||
/// A staged sync pipeline.
|
/// A staged sync pipeline.
|
||||||
///
|
///
|
||||||
/// The pipeline executes queued [stages][Stage] serially. An external component determines the tip
|
/// The pipeline executes queued [stages][Stage] serially. An external component determines the tip
|
||||||
@ -27,6 +28,40 @@ use state::*;
|
|||||||
/// After the entire pipeline has been run, it will run again unless asked to stop (see
|
/// After the entire pipeline has been run, it will run again unless asked to stop (see
|
||||||
/// [Pipeline::set_max_block]).
|
/// [Pipeline::set_max_block]).
|
||||||
///
|
///
|
||||||
|
/// ```mermaid
|
||||||
|
/// graph TB
|
||||||
|
/// Start[Start]
|
||||||
|
/// Done[Done]
|
||||||
|
/// Error[Error]
|
||||||
|
/// subgraph Unwind
|
||||||
|
/// StartUnwind(Unwind by unwind priority)
|
||||||
|
/// UnwindStage(Unwind stage)
|
||||||
|
/// NextStageToUnwind(Next stage)
|
||||||
|
/// end
|
||||||
|
/// subgraph Single loop
|
||||||
|
/// RunLoop(Run loop)
|
||||||
|
/// NextStage(Next stage)
|
||||||
|
/// LoopDone(Loop done)
|
||||||
|
/// subgraph Stage Execution
|
||||||
|
/// Execute(Execute stage)
|
||||||
|
/// end
|
||||||
|
/// end
|
||||||
|
/// Start --> RunLoop --> NextStage
|
||||||
|
/// NextStage --> |No stages left| LoopDone
|
||||||
|
/// NextStage --> |Next stage| Execute
|
||||||
|
/// Execute --> |Not done| Execute
|
||||||
|
/// Execute --> |Unwind requested| StartUnwind
|
||||||
|
/// Execute --> |Done| NextStage
|
||||||
|
/// Execute --> |Error| Error
|
||||||
|
/// StartUnwind --> NextStageToUnwind
|
||||||
|
/// NextStageToUnwind --> |Next stage| UnwindStage
|
||||||
|
/// NextStageToUnwind --> |No stages left| RunLoop
|
||||||
|
/// UnwindStage --> |Error| Error
|
||||||
|
/// UnwindStage --> |Unwound| NextStageToUnwind
|
||||||
|
/// LoopDone --> |Target block reached| Done
|
||||||
|
/// LoopDone --> |Target block not reached| RunLoop
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// # Unwinding
|
/// # Unwinding
|
||||||
///
|
///
|
||||||
/// In case of a validation error (as determined by the consensus engine) in one of the stages, the
|
/// In case of a validation error (as determined by the consensus engine) in one of the stages, the
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use reth_primitives::BlockNumber;
|
use reth_primitives::BlockNumber;
|
||||||
|
|
||||||
/// An event emitted by a [Pipeline].
|
/// An event emitted by a [Pipeline][crate::Pipeline].
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum PipelineEvent {
|
pub enum PipelineEvent {
|
||||||
/// Emitted when a stage is about to be run.
|
/// Emitted when a stage is about to be run.
|
||||||
|
|||||||
Reference in New Issue
Block a user