[][src]Struct hbbft::queueing_honey_badger::QueueingHoneyBadger

pub struct QueueingHoneyBadger<T, N: Ord, Q> { /* fields omitted */ }

A Honey Badger instance that can handle adding and removing nodes and manages a transaction queue.

Methods

impl<T, N, Q> QueueingHoneyBadger<T, N, Q> where
    T: Contribution + Serialize + DeserializeOwned + Clone,
    N: NodeIdT + Serialize + DeserializeOwned,
    Q: TransactionQueue<T>,
    Standard: Distribution<N>, 
[src]

pub fn builder(
    dyn_hb: DynamicHoneyBadger<Vec<T>, N>
) -> QueueingHoneyBadgerBuilder<T, N, Q>
[src]

Returns a new QueueingHoneyBadgerBuilder configured to use the node IDs and cryptographic keys specified by netinfo.

pub fn builder_joining<R: Rng>(
    our_id: N,
    secret_key: SecretKey,
    join_plan: JoinPlan<N>,
    rng: &mut R
) -> Result<QueueingHoneyBadgerBuilder<T, N, Q>>
[src]

Creates a new QueueingHoneyBadgerBuilder for joining the network specified in the JoinPlan.

Returns a QueueingHoneyBadgerBuilder or an error if creation of the managed DynamicHoneyBadger instance has failed.

pub fn push_transaction<R: Rng>(
    &mut self,
    tx: T,
    rng: &mut R
) -> Result<Step<T, N>>
[src]

Adds a transaction to the queue.

This can be called at any time to append to the transaction queue. The new transaction will be proposed in some future epoch.

If no proposal has yet been made for the current epoch, this may trigger one. In this case, a nonempty step will returned, with the corresponding messages. (Or, if we are the only validator, even with the completed batch as an output.)

pub fn vote_for<R: Rng>(
    &mut self,
    change: Change<N>,
    rng: &mut R
) -> Result<Step<T, N>>
[src]

Casts a vote to change the set of validators.

This stores a pending vote for the change. It will be included in some future batch, and once enough validators have been voted for the same change, it will take effect.

pub fn vote_to_add<R: Rng>(
    &mut self,
    node_id: N,
    pub_key: PublicKey,
    rng: &mut R
) -> Result<Step<T, N>>
[src]

Casts a vote to add a node as a validator.

This stores a pending vote for the change. It will be included in some future batch, and once enough validators have been voted for the same change, it will take effect.

pub fn vote_to_remove<R: Rng>(
    &mut self,
    node_id: &N,
    rng: &mut R
) -> Result<Step<T, N>>
[src]

Casts a vote to demote a validator to observer.

This stores a pending vote for the change. It will be included in some future batch, and once enough validators have been voted for the same change, it will take effect.

pub fn handle_message<R: Rng>(
    &mut self,
    sender_id: &N,
    message: Message<N>,
    rng: &mut R
) -> Result<Step<T, N>>
[src]

Handles a message received from sender_id.

This must be called with every message we receive from another node.

pub fn dyn_hb(&self) -> &DynamicHoneyBadger<Vec<T>, N>[src]

Returns a reference to the internal managed DynamicHoneyBadger instance.

pub fn netinfo(&self) -> &NetworkInfo<N>[src]

Returns the information about the node IDs in the network, and the cryptographic keys.

pub fn queue(&self) -> &Q[src]

Returns the current queue of the QueueingHoneyBadger.

pub fn next_epoch(&self) -> u64[src]

Returns the epoch of the next batch that will be output.

Trait Implementations

impl<T, N, Q> Epoched for QueueingHoneyBadger<T, N, Q> where
    T: Contribution + Serialize + DeserializeOwned + Clone,
    N: NodeIdT + Serialize + DeserializeOwned,
    Q: TransactionQueue<T>,
    Standard: Distribution<N>, 
[src]

type Epoch = (u64, u64)

Type of epoch.

impl<T, N, Q> ConsensusProtocol for QueueingHoneyBadger<T, N, Q> where
    T: Contribution + Serialize + DeserializeOwned + Clone,
    N: NodeIdT + Serialize + DeserializeOwned,
    Q: TransactionQueue<T>,
    Standard: Distribution<N>, 
[src]

type NodeId = N

Unique node identifier.

type Input = Input<T, N>

The input provided by the user.

type Output = Batch<T, N>

The output type. Some algorithms return an output exactly once, others return multiple times. Read more

type Message = Message<N>

The messages that need to be exchanged between the instances in the participating nodes.

type Error = Error

The errors that can occur during execution.

type FaultKind = FaultKind

The kinds of message faults that can be detected during execution.

impl<T, N, Q> SenderQueueableConsensusProtocol for QueueingHoneyBadger<T, N, Q> where
    T: Contribution + Serialize + DeserializeOwned + Clone,
    N: NodeIdT + Serialize + DeserializeOwned,
    Q: TransactionQueue<T>,
    Standard: Distribution<N>, 
[src]

impl<T, N: Ord, Q> Debug for QueueingHoneyBadger<T, N, Q> where
    T: Debug,
    N: Debug,
    Q: Debug
[src]

Auto Trait Implementations

impl<T, N, Q> Send for QueueingHoneyBadger<T, N, Q> where
    N: Send + Sync,
    Q: Send,
    T: Send

impl<T, N, Q> Sync for QueueingHoneyBadger<T, N, Q> where
    N: Send + Sync,
    Q: Sync,
    T: Sync

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.