Trait Supervisor

Source
pub trait Supervisor:
    Clone
    + Send
    + Sync
    + 'static {
    type Index;
    type PublicKey: Array;

    // Required methods
    fn leader(&self, index: Self::Index) -> Option<Self::PublicKey>;
    fn participants(&self, index: Self::Index) -> Option<&Vec<Self::PublicKey>>;
    fn is_participant(
        &self,
        index: Self::Index,
        candidate: &Self::PublicKey,
    ) -> Option<u32>;
    fn report(
        &self,
        activity: Activity,
        proof: Proof,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Supervisor is the interface responsible for managing which participants are active at a given time.

§Synchronization

It is up to the user to ensure changes in this list are synchronized across nodes in the network at a given Index. If care is not taken to do this, consensus could halt (as different participants may have a different view of who is active at a given time).

The simplest way to avoid this complexity is to use a consensus implementation that reaches finalization on application data before transitioning to a new Index (i.e. Tendermint).

Implementations that do not work this way (like simplex) must introduce some synchrony bound for changes (where it is assumed all participants have finalized some previous set change by some point) or “sync points” (i.e. epochs) where participants agree that some finalization occurred at some point in the past.

Required Associated Types§

Source

type Index

Index is the type used to indicate the in-progress consensus decision.

Source

type PublicKey: Array

Public key used to identify participants.

Required Methods§

Source

fn leader(&self, index: Self::Index) -> Option<Self::PublicKey>

Return the leader at a given index for the provided seed.

Source

fn participants(&self, index: Self::Index) -> Option<&Vec<Self::PublicKey>>

Get the sorted participants for the given view. This is called when entering a new view before listening for proposals or votes. If nothing is returned, the view will not be entered.

Source

fn is_participant( &self, index: Self::Index, candidate: &Self::PublicKey, ) -> Option<u32>

Source

fn report( &self, activity: Activity, proof: Proof, ) -> impl Future<Output = ()> + Send

Report some activity observed by the consensus implementation.

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§