pub trait BlockStorage:
Clone
+ Send
+ Sync {
// Required methods
fn get_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [BlockType],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_missed_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_missed_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
max_block_age: u64,
current_block: u64,
max_retries: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<MissedBlockEntry>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_missed_block_status<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_number: u64,
status: MissedBlockStatus,
error: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_recovered_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_numbers: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn prune_old_missed_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
max_block_age: u64,
current_block: u64,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Interface for block storage implementations
Defines the required functionality for storing and retrieving blocks and tracking the last processed block for each network.
Required Methods§
Sourcefn get_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn save_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [BlockType],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [BlockType],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn delete_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn save_missed_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_missed_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
blocks: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn get_missed_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
max_block_age: u64,
current_block: u64,
max_retries: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<MissedBlockEntry>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_missed_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
max_block_age: u64,
current_block: u64,
max_retries: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<MissedBlockEntry>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves missed blocks eligible for recovery
Returns blocks that are within the max_block_age range and have status Pending with retry_count below max_retries.
§Arguments
network_id- Unique identifier for the networkmax_block_age- Maximum age in blocks from current_blockcurrent_block- The current block numbermax_retries- Maximum retry attempts; blocks with retry_count >= max_retries are excluded
§Returns
Result<Vec<MissedBlockEntry>, anyhow::Error>- Eligible missed blocks
Sourcefn update_missed_block_status<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_number: u64,
status: MissedBlockStatus,
error: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_missed_block_status<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_number: u64,
status: MissedBlockStatus,
error: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn remove_recovered_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_numbers: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_recovered_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block_numbers: &'life2 [u64],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.