Quorum

Trait Quorum 

Source
pub trait Quorum {
    type Item: Ord;

    // Required methods
    fn quorum(&self) -> u32;
    fn max_faults(&self) -> u32;
    fn key(&self, index: u32) -> Option<&Self::Item>;
    fn index(&self, key: &Self::Item) -> Option<u32>;
}
Expand description

Extension trait for Set participant sets providing quorum and index utilities.

Required Associated Types§

Source

type Item: Ord

The type of items in this set.

Required Methods§

Source

fn quorum(&self) -> u32

Returns the quorum value (2f+1) for this participant set.

§Panics

Panics if the number of participants exceeds u32::MAX.

Source

fn max_faults(&self) -> u32

Returns the maximum number of faults (f) tolerated by this participant set.

§Panics

Panics if the number of participants exceeds u32::MAX.

Source

fn key(&self, index: u32) -> Option<&Self::Item>

Returns the participant key at the given index.

Source

fn index(&self, key: &Self::Item) -> Option<u32>

Returns the index for the given participant key, if present.

§Panics

Panics if the participant index exceeds u32::MAX.

Implementors§

Source§

impl<T: Ord> Quorum for Set<T>

Source§

type Item = T