[][src]Struct rhododendron::accumulator::Accumulator

pub struct Accumulator<Candidate, Digest, AuthorityId, Signature> where
    Candidate: Eq + Clone,
    Digest: Hash + Eq + Clone,
    AuthorityId: Hash + Eq + Clone,
    Signature: Eq + Clone
{ pub round_number: u32, pub threshold: usize, pub round_proposer: AuthorityId, // some fields omitted }

Accumulates messages for a given round of BFT consensus.

This isn't tied to the "view" of a single authority. It keeps accurate track of the state of the BFT consensus based on all messages imported.

Fields

round_number: u32

The round this accumulator is currently on

threshold: usize

Threshold of prepare messages required to make progress

round_proposer: AuthorityId

Current proposer/authority for this round

Methods

impl<Candidate, Digest, AuthorityId, Signature> Accumulator<Candidate, Digest, AuthorityId, Signature> where
    Candidate: Eq + Clone,
    Digest: Hash + Eq + Clone,
    AuthorityId: Hash + Eq + Clone,
    Signature: Eq + Clone
[src]

pub fn new(
    round_number: u32,
    threshold: usize,
    round_proposer: AuthorityId
) -> Self
[src]

Create a new state accumulator.

pub fn advance_votes(&self) -> usize[src]

How advance votes we have seen.

pub fn round_number(&self) -> u32[src]

Get the round number.

pub fn round_proposer(&self) -> AuthorityId[src]

Get the round proposer.

pub fn proposal(&self) -> Option<&Candidate>[src]

pub fn participants(&self) -> HashSet<&AuthorityId>[src]

Returns a HashSet of AuthorityIds we've seen participating at any step in this round

pub fn voters(&self) -> HashSet<&AuthorityId>[src]

Returns a HashSet of AuthorityIds we've seen voting at any step in this round. Does not include those who we've only seen broadcast AdvanceRound.

pub fn state(&self) -> &State<Candidate, Digest, Signature>[src]

Inspect the current consensus state.

pub fn import_message(
    &mut self,
    message: LocalizedMessage<Candidate, Digest, AuthorityId, Signature>
) -> Result<(), Misbehavior<Digest, Signature>>
[src]

Import a message. Importing duplicates is fine, but the signature and authorization should have already been checked.

Trait Implementations

impl<Candidate: Debug, Digest: Debug, AuthorityId: Debug, Signature: Debug> Debug for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    Candidate: Eq + Clone,
    Digest: Hash + Eq + Clone,
    AuthorityId: Hash + Eq + Clone,
    Signature: Eq + Clone
[src]

Auto Trait Implementations

impl<Candidate, Digest, AuthorityId, Signature> Sync for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    AuthorityId: Sync,
    Candidate: Sync,
    Digest: Sync,
    Signature: Sync

impl<Candidate, Digest, AuthorityId, Signature> Send for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    AuthorityId: Send,
    Candidate: Send,
    Digest: Send,
    Signature: Send

impl<Candidate, Digest, AuthorityId, Signature> Unpin for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    AuthorityId: Unpin,
    Candidate: Unpin,
    Digest: Unpin,
    Signature: Unpin

impl<Candidate, Digest, AuthorityId, Signature> RefUnwindSafe for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    AuthorityId: RefUnwindSafe,
    Candidate: RefUnwindSafe,
    Digest: RefUnwindSafe,
    Signature: RefUnwindSafe

impl<Candidate, Digest, AuthorityId, Signature> UnwindSafe for Accumulator<Candidate, Digest, AuthorityId, Signature> where
    AuthorityId: UnwindSafe,
    Candidate: UnwindSafe,
    Digest: UnwindSafe,
    Signature: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]