Skip to main content

ConsensusPlugin

Trait ConsensusPlugin 

Source
pub trait ConsensusPlugin: 'static {
    type Scope: ConsensusScope + From<String> + 'static;
    type ConsensusStorage: ConsensusStorage<Self::Scope> + 'static;
    type EventBus: ConsensusEventBus<Self::Scope> + 'static;
    type Signer: ConsensusSignatureScheme + Clone + 'static;

    // Required methods
    fn new_storage() -> Self::ConsensusStorage;
    fn new_event_bus() -> Self::EventBus;
}
Expand description

User-level consensus backend bundle. Carries the four types the hashgraph_like_consensus service is parameterised by: the scope key (one consensus partition per conversation), proposal/vote storage, outcome event bus, and the signature scheme used to authenticate votes. The concrete service is materialised via PluginConsensus.

Required Associated Types§

Source

type Scope: ConsensusScope + From<String> + 'static

Conversation-identifier type used as consensus scope (default: String).

Source

type ConsensusStorage: ConsensusStorage<Self::Scope> + 'static

Proposal/vote persistence (default: InMemoryConsensusStorage<String>).

Source

type EventBus: ConsensusEventBus<Self::Scope> + 'static

Consensus-outcome delivery (default: BroadcastEventBus<String>).

Source

type Signer: ConsensusSignatureScheme + Clone + 'static

Signature scheme for authenticating votes (default: hashgraph_like_consensus::signing::EthereumConsensusSigner). All peers on a network must agree.

Required Methods§

Source

fn new_storage() -> Self::ConsensusStorage

Build a fresh storage handle. Called once at User init; the handle is cloned per conversation so all per-conv ConsensusService instances share one underlying persistence (see upstream “per-scope service composition” pattern).

Source

fn new_event_bus() -> Self::EventBus

Build a fresh event bus for one conversation. Each per-conv ConsensusService owns its own bus; subscribers automatically see only that conversation’s events.

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.

Implementors§