use massa_models::{
block_id::BlockId,
denunciation::{Denunciation, DenunciationPrecursor},
endorsement::EndorsementId,
operation::OperationId,
slot::Slot,
};
use massa_storage::Storage;
use massa_time::MassaTime;
use crate::error::PoolError;
#[cfg(feature = "test-exports")]
use std::sync::{Arc, RwLock};
#[cfg_attr(feature = "test-exports", mockall_wrap::wrap, mockall::automock)]
pub trait PoolController: Send + Sync {
fn add_operations(&mut self, ops: Storage);
fn add_endorsements(&mut self, endorsements: Storage);
fn add_denunciation_precursor(&self, denunciation_precursor: DenunciationPrecursor);
fn notify_final_cs_periods(&mut self, final_cs_periods: &[u64]);
fn get_block_operations(
&self,
slot: &Slot,
timeout: Option<MassaTime>,
) -> Result<(Vec<OperationId>, Storage), PoolError>;
fn get_block_endorsements(
&self,
target_block: &BlockId,
slot: &Slot,
timeout: Option<MassaTime>,
) -> Result<(Vec<Option<EndorsementId>>, Storage), PoolError>;
fn get_block_denunciations(
&self,
target_slot: &Slot,
timeout: Option<MassaTime>,
) -> Result<Vec<Denunciation>, PoolError>;
fn get_endorsement_count(&self, timeout: Option<MassaTime>) -> Result<usize, PoolError>;
fn get_operation_count(&self, timeout: Option<MassaTime>) -> Result<usize, PoolError>;
fn contains_endorsements(
&self,
endorsements: &[EndorsementId],
timeout: Option<MassaTime>,
) -> Result<Vec<bool>, PoolError>;
fn contains_operations(
&self,
operations: &[OperationId],
timeout: Option<MassaTime>,
) -> Result<Vec<bool>, PoolError>;
fn get_denunciation_count(&self, timeout: Option<MassaTime>) -> Result<usize, PoolError>;
fn clone_box(&self) -> Box<dyn PoolController>;
fn get_final_cs_periods(&self) -> Vec<u64>;
}
impl Clone for Box<dyn PoolController> {
fn clone(&self) -> Box<dyn PoolController> {
self.clone_box()
}
}
pub trait PoolManager: Send + Sync {
fn stop(&mut self);
}