mithril_common/chain_reader/
interface.rs

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