Struct brb::deterministic_brb::DeterministicBRB[][src]

pub struct DeterministicBRB<A: Actor<S>, SA: SigningActor<A, S>, S: Sig, BRBDT: BRBDataType<A>> {
    pub membership: State<A, SA, S>,
    pub pending_proof: HashMap<Msg<A, BRBDT::Op>, BTreeMap<A, S>>,
    pub pending_delivery: HashMap<Msg<A, BRBDT::Op>, (BTreeMap<A, S>, BTreeSet<A>)>,
    pub received: VClock<A>,
    pub delivered: VClock<A>,
    pub history_from_source: BTreeMap<A, Vec<(Msg<A, BRBDT::Op>, BTreeMap<A, S>)>>,
    pub dt: BRBDT,
}
Expand description

DeterministicBRB – the heart and soul of BRB.

Fields

membership: State<A, SA, S>

The identity of a process

pending_proof: HashMap<Msg<A, BRBDT::Op>, BTreeMap<A, S>>

Msgs this process has initiated and is waiting on BFT agreement for from the network.

pending_delivery: HashMap<Msg<A, BRBDT::Op>, (BTreeMap<A, S>, BTreeSet<A>)>

Msgs this process has sent ProofOfAgreement for but has not yet received a super-majority of delivery confirmations.

received: VClock<A>

The clock representing the most recently received messages from each process. These are messages that have been acknowledged but not yet This clock must at all times be greator or equal to the delivered clock.

delivered: VClock<A>

The clock representing the most recent msgs we’ve delivered to the underlying datatype dt.

history_from_source: BTreeMap<A, Vec<(Msg<A, BRBDT::Op>, BTreeMap<A, S>)>>

History is maintained to onboard new members

dt: BRBDT

The state of the datatype that we are running BFT over. This can be the causal bank described in AT2, or it can be a CRDT.

Implementations

returns a new DeterministicBRB

returns the Actor

returns a set of known peers

Locally adds a peer to voting group without going through the regular brb_membership join + voting process.

Locally removes a peer from voting group without going through the regular brb_membership leave + voting process.

Proposes membership for an Actor.

The node proposing membership must already be a voting member and thus typically will be proposing to add a different non-voting actor.

In other words, a node may not directly propose to add itself, but instead must have a sponsor.

Proposes that a member be removed from the voting group.

The node proposing membership must already be a voting member and may propose that self or another member be removed.

See https://github.com/maidsafe/brb/issues/18

Sends an AntiEntropy packet to the given peer, indicating the last generation we have seen.

The remote peer should respond with history since our last-seen generation to bring our peer up-to-date.

If we have not seen any generation, then this becomes a means to bootstrap our node from the “genesis” generation.

Resend any proof of agreements that we have not yet received delivery confirmation for.

Resend any RequestValidation packets that have not yet received enough signatures.

Resend any messages for which we haven’t received a response.

Initiates the BRB process for an operation on the BRBDataType.

Returns BRB packets to be delivered to other network members. Packets destined to ourselves will short-circuited and handled to completion before this method returns.

This short-circuiting is done to remove some potential race-conditions when BRB is integrated into a highly concurrent application where multiple threads are concurrently fighting to initiate BRB operations.

NOTE: Network members will refuse to sign multiple operations from a source concurrently. It’s recommended to ensure there aren’t any pending deliveries before you initiate a new operation to reduce the chance of this happening. A naive implementation of this would be:

let mut packets_to_resend = brb.resend_pending_msgs()?;

while !packets_to_resend.is_empty() {
   // ... re-send these packets
   network.send_packets(packets_to_resend);
   sleep(TIMEOUT_SECONDS);
   packets_to_resend = brb.resend_pending_msgs()?;
}

brb.exec_op(op)?;

handles an incoming BRB Packet.

Trait Implementations

Formats the value using the given formatter. Read more

returns a default DeterministicBRB

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.