Struct parsec::Parsec[][src]

pub struct Parsec<T: NetworkEvent, S: SecretId> { /* fields omitted */ }

The main object which manages creating and receiving gossip about network events from peers, and which provides a sequence of consensused Blocks by applying the PARSEC algorithm.

Methods

impl<T: NetworkEvent, S: SecretId> Parsec<T, S>
[src]

Creates a new Parsec for a peer with the given ID and genesis peer IDs (ours included).

Adds a vote for network_event. Returns an error if we have already voted for this.

Creates a new message to be gossiped to a peer containing all gossip events this node thinks that peer needs. If peer_id is None, a message containing all known gossip events is returned. If peer_id is Some and the given peer is unknown to this node, an error is returned.

Handles a received Request from src peer. Returns a Response to be sent back to src or Err if the request was not valid.

Handles a received Response from src peer. Returns Err if the response was not valid.

Steps the algorithm and returns the next stable block, if any.

Checks if the given network_event has already been voted for by us.

Trait Implementations

impl<T: NetworkEvent, S: SecretId> Drop for Parsec<T, S>
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<T, S> Send for Parsec<T, S> where
    S: Send,
    T: Send,
    <S as SecretId>::PublicId: Send,
    <<S as SecretId>::PublicId as PublicId>::Signature: Send

impl<T, S> Sync for Parsec<T, S> where
    S: Sync,
    T: Sync,
    <S as SecretId>::PublicId: Sync,
    <<S as SecretId>::PublicId as PublicId>::Signature: Sync