feat: provide backfill outcome in finished event (#9692)

This commit is contained in:
Matthias Seitz
2024-07-22 15:05:08 +02:00
committed by GitHub
parent 6c720579bb
commit 8dad8c4e97
3 changed files with 7 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
use crate::backfill::{BackfillAction, BackfillEvent, BackfillSync};
use futures::Stream;
use reth_stages_api::PipelineTarget;
use reth_stages_api::{ControlFlow, PipelineTarget};
use std::{
pin::Pin,
task::{Context, Poll},
@@ -88,10 +88,10 @@ where
}
BackfillEvent::Finished(res) => {
return match res {
Ok(event) => {
tracing::debug!(?event, "backfill sync finished");
Ok(ctrl) => {
tracing::debug!(?ctrl, "backfill sync finished");
// notify handler that backfill sync finished
this.handler.on_event(FromOrchestrator::BackfillSyncFinished);
this.handler.on_event(FromOrchestrator::BackfillSyncFinished(ctrl));
Poll::Ready(ChainEvent::BackfillSyncFinished)
}
Err(err) => {
@@ -196,7 +196,7 @@ pub enum HandlerEvent<T> {
#[derive(Clone, Debug)]
pub enum FromOrchestrator {
/// Invoked when backfill sync finished
BackfillSyncFinished,
BackfillSyncFinished(ControlFlow),
/// Invoked when backfill sync started
BackfillSyncStarted,
}

View File

@@ -387,7 +387,7 @@ where
debug!(target: "consensus::engine", "received backfill sync started event");
self.is_backfill_active = true;
}
FromOrchestrator::BackfillSyncFinished => {
FromOrchestrator::BackfillSyncFinished(_ctrl) => {
debug!(target: "consensus::engine", "received backfill sync finished event");
self.is_backfill_active = false;
}

View File

@@ -4,7 +4,7 @@ use reth_primitives_traits::SealedHeader;
/// Determines the control flow during pipeline execution.
///
/// See [`Pipeline::run_loop`](crate::Pipeline::run_loop) for more information.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ControlFlow {
/// An unwind was requested and must be performed before continuing.
Unwind {