Struct finality_grandpa::voter::Voter[][src]

pub struct Voter<H, N, E: Environment<H, N>, GlobalIn, GlobalOut> where
    H: Clone + Eq + Ord + Debug,
    N: Copy + BlockNumberOps + Debug,
    GlobalIn: Stream<Item = Result<CommunicationIn<H, N, E::Signature, E::Id>, E::Error>> + Unpin,
    GlobalOut: Sink<CommunicationOut<H, N, E::Signature, E::Id>, Error = E::Error> + Unpin
{ /* fields omitted */ }

A future that maintains and multiplexes between different rounds, and caches votes.

This voter also implements the commit protocol. The commit protocol allows a node to broadcast a message that finalizes a given block and includes a set of precommits as proof.

Additionally, we also listen to commit messages from rounds that aren’t currently running, we validate the commit and dispatch a finalization notification (if any) to the environment.

Implementations

impl<'a, H: 'a, N, E: 'a, GlobalIn, GlobalOut> Voter<H, N, E, GlobalIn, GlobalOut> where
    H: Clone + Ord + Debug + Sync + Send,
    N: BlockNumberOps + Sync + Send,
    E: Environment<H, N> + Sync + Send,
    GlobalIn: Stream<Item = Result<CommunicationIn<H, N, E::Signature, E::Id>, E::Error>> + Unpin,
    GlobalOut: Sink<CommunicationOut<H, N, E::Signature, E::Id>, Error = E::Error> + Unpin
[src]

pub fn voter_state(&self) -> Box<dyn VoterState<E::Id> + Send + Sync + 'a> where
    <E as Environment<H, N>>::Signature: Send + Sync,
    <E as Environment<H, N>>::Id: Hash + Send + Sync,
    <E as Environment<H, N>>::Timer: Send + Sync,
    <E as Environment<H, N>>::Out: Send + Sync,
    <E as Environment<H, N>>::In: Send + Sync
[src]

Returns an object allowing to query the voter state.

impl<H, N, E: Environment<H, N>, GlobalIn, GlobalOut> Voter<H, N, E, GlobalIn, GlobalOut> where
    H: Clone + Eq + Ord + Debug,
    N: Copy + BlockNumberOps + Debug,
    GlobalIn: Stream<Item = Result<CommunicationIn<H, N, E::Signature, E::Id>, E::Error>> + Unpin,
    GlobalOut: Sink<CommunicationOut<H, N, E::Signature, E::Id>, Error = E::Error> + Unpin
[src]

pub fn new(
    env: Arc<E>,
    voters: VoterSet<E::Id>,
    global_comms: (GlobalIn, GlobalOut),
    last_round_number: u64,
    last_round_votes: Vec<SignedMessage<H, N, E::Signature, E::Id>>,
    last_round_base: (H, N),
    last_finalized: (H, N)
) -> Self
[src]

Create new Voter tracker with given round number and base block.

Provide data about the last completed round. If there is no known last completed round, the genesis state (round number 0, no votes, genesis base), should be provided. When available, all messages required to complete the last round should be provided.

The input stream for commit messages should provide commits which correspond to known blocks only (including all its precommits). It is also responsible for validating the signature data in commit messages.

Trait Implementations

impl<H, N, E: Environment<H, N>, GlobalIn, GlobalOut> Future for Voter<H, N, E, GlobalIn, GlobalOut> where
    H: Clone + Eq + Ord + Debug,
    N: Copy + BlockNumberOps + Debug,
    GlobalIn: Stream<Item = Result<CommunicationIn<H, N, E::Signature, E::Id>, E::Error>> + Unpin,
    GlobalOut: Sink<CommunicationOut<H, N, E::Signature, E::Id>, Error = E::Error> + Unpin
[src]

type Output = Result<(), E::Error>

The type of value produced on completion.

impl<H, N, E: Environment<H, N>, GlobalIn, GlobalOut> Unpin for Voter<H, N, E, GlobalIn, GlobalOut> where
    H: Clone + Eq + Ord + Debug,
    N: Copy + BlockNumberOps + Debug,
    GlobalIn: Stream<Item = Result<CommunicationIn<H, N, E::Signature, E::Id>, E::Error>> + Unpin,
    GlobalOut: Sink<CommunicationOut<H, N, E::Signature, E::Id>, Error = E::Error> + Unpin
[src]

Auto Trait Implementations

impl<H, N, E, GlobalIn, GlobalOut> !RefUnwindSafe for Voter<H, N, E, GlobalIn, GlobalOut>

impl<H, N, E, GlobalIn, GlobalOut> Send for Voter<H, N, E, GlobalIn, GlobalOut> where
    E: Send + Sync,
    GlobalIn: Send,
    GlobalOut: Send,
    H: Send + Sync,
    N: Send + Sync,
    <E as Environment<H, N>>::Id: Send + Sync,
    <E as Environment<H, N>>::In: Send + Sync,
    <E as Environment<H, N>>::Out: Send + Sync,
    <E as Environment<H, N>>::Signature: Send + Sync,
    <E as Environment<H, N>>::Timer: Send + Sync

impl<H, N, E, GlobalIn, GlobalOut> Sync for Voter<H, N, E, GlobalIn, GlobalOut> where
    E: Send + Sync,
    GlobalIn: Sync,
    GlobalOut: Sync,
    H: Send + Sync,
    N: Send + Sync,
    <E as Environment<H, N>>::Id: Send + Sync,
    <E as Environment<H, N>>::In: Send + Sync,
    <E as Environment<H, N>>::Out: Send + Sync,
    <E as Environment<H, N>>::Signature: Send + Sync,
    <E as Environment<H, N>>::Timer: Send + Sync

impl<H, N, E, GlobalIn, GlobalOut> !UnwindSafe for Voter<H, N, E, GlobalIn, GlobalOut>

Blanket Implementations

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

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

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

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

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

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

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

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<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

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.