reth_storage_api/
block_indices.rs

1use alloc::vec::Vec;
2use alloy_primitives::BlockNumber;
3use core::ops::RangeInclusive;
4use reth_db_models::StoredBlockBodyIndices;
5use reth_storage_errors::provider::ProviderResult;
6
7///  Client trait for fetching block body indices related data.
8#[auto_impl::auto_impl(&, Arc)]
9pub trait BlockBodyIndicesProvider: Send + Sync {
10    /// Returns the block body indices with matching number from database.
11    ///
12    /// Returns `None` if block is not found.
13    fn block_body_indices(&self, num: u64) -> ProviderResult<Option<StoredBlockBodyIndices>>;
14
15    /// Returns the block body indices within the requested range matching number from storage.
16    fn block_body_indices_range(
17        &self,
18        range: RangeInclusive<BlockNumber>,
19    ) -> ProviderResult<Vec<StoredBlockBodyIndices>>;
20}