mithril_cardano_node_chain/chain_reader/
interface.rs

1use async_trait::async_trait;
2
3use mithril_common::StdResult;
4
5use crate::entities::{ChainBlockNextAction, RawCardanoPoint};
6
7/// The trait that reads events to either:
8/// - read next block on the chain
9/// - rollback to another point in case of rollback
10/// - do nothing when tip of the chain is reached
11#[async_trait]
12pub trait ChainBlockReader: Send + Sync {
13    /// Sets the chain point
14    async fn set_chain_point(&mut self, point: &RawCardanoPoint) -> StdResult<()>;
15
16    /// Get the next chain block
17    async fn get_next_chain_block(&mut self) -> StdResult<Option<ChainBlockNextAction>>;
18}