pub trait Membership<TYPES: NodeType>: Clone + Debug + Eq + PartialEq + Send + Sync + Hash + 'static {
    // Required methods
    fn new(
        eligible_leaders: Vec<PeerConfig<TYPES::SignatureKey>>,
        committee_members: Vec<PeerConfig<TYPES::SignatureKey>>,
        committee_topic: Topic
    ) -> Self;
    fn stake_table(
        &self
    ) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
    fn committee_members(
        &self,
        view_number: TYPES::Time
    ) -> BTreeSet<TYPES::SignatureKey>;
    fn stake(
        &self,
        pub_key: &TYPES::SignatureKey
    ) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
    fn has_stake(&self, pub_key: &TYPES::SignatureKey) -> bool;
    fn leader(&self, view_number: TYPES::Time) -> TYPES::SignatureKey;
    fn committee_topic(&self) -> Topic;
    fn total_nodes(&self) -> usize;
    fn success_threshold(&self) -> NonZeroU64;
    fn failure_threshold(&self) -> NonZeroU64;
    fn upgrade_threshold(&self) -> NonZeroU64;
}
Expand description

A protocol for determining membership in and participating in a committee.

Required Methods§

source

fn new( eligible_leaders: Vec<PeerConfig<TYPES::SignatureKey>>, committee_members: Vec<PeerConfig<TYPES::SignatureKey>>, committee_topic: Topic ) -> Self

Create a committee

source

fn stake_table( &self ) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>

Get all participants in the committee (including their stake)

source

fn committee_members( &self, view_number: TYPES::Time ) -> BTreeSet<TYPES::SignatureKey>

Get all participants in the committee for a specific view

source

fn stake( &self, pub_key: &TYPES::SignatureKey ) -> Option<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>

Get the stake table entry for a public key, returns None if the key is not in the table

source

fn has_stake(&self, pub_key: &TYPES::SignatureKey) -> bool

See if a node has stake in the committee

source

fn leader(&self, view_number: TYPES::Time) -> TYPES::SignatureKey

The leader of the committee for view view_number.

source

fn committee_topic(&self) -> Topic

Get the network topic for the committee

source

fn total_nodes(&self) -> usize

Returns the number of total nodes in the committee

source

fn success_threshold(&self) -> NonZeroU64

Returns the threshold for a specific Membership implementation

source

fn failure_threshold(&self) -> NonZeroU64

Returns the threshold for a specific Membership implementation

source

fn upgrade_threshold(&self) -> NonZeroU64

Returns the threshold required to upgrade the network protocol

Object Safety§

This trait is not object safe.

Implementors§