use hashgraph_like_consensus::{
events::ConsensusEventBus, scope::ConsensusScope, service::ConsensusService,
signing::ConsensusSignatureScheme, storage::ConsensusStorage, types::ConsensusEvent,
};
pub trait SyncConsensusReceiver<Scope: ConsensusScope>: Send {
fn try_recv(&mut self) -> Option<(Scope, ConsensusEvent)>;
}
pub trait ConsensusPlugin {
type Scope: ConsensusScope + From<String>;
type ConsensusStorage: ConsensusStorage<Self::Scope>;
type EventBus: ConsensusEventBus<Self::Scope, Receiver: SyncConsensusReceiver<Self::Scope>>;
type Signer: ConsensusSignatureScheme + Clone + 'static;
fn new_storage() -> Self::ConsensusStorage;
fn new_event_bus() -> Self::EventBus;
}
pub type ConsensusServiceFor<C> = ConsensusService<
<C as ConsensusPlugin>::Scope,
<C as ConsensusPlugin>::ConsensusStorage,
<C as ConsensusPlugin>::EventBus,
<C as ConsensusPlugin>::Signer,
>;