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
impl<A: Actor<S>, SA: SigningActor<A, S>, S: Sig, BRBDT: BRBDataType<A>> DeterministicBRB<A, SA, S, BRBDT>
[src]
impl<A: Actor<S>, SA: SigningActor<A, S>, S: Sig, BRBDT: BRBDataType<A>> DeterministicBRB<A, SA, S, BRBDT>
[src]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.
pub fn request_membership(
&mut self,
actor: A
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn request_membership(
&mut self,
actor: A
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]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
pub fn anti_entropy(
&self,
peer: A
) -> Result<Packet<A, S, BRBDT::Op>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn anti_entropy(
&self,
peer: A
) -> Result<Packet<A, S, BRBDT::Op>, Error<A, S, BRBDT::ValidationError>>
[src]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.
pub fn resend_pending_deliveries(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn resend_pending_deliveries(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]Resend any proof of agreements that we have not yet received delivery confirmation for.
pub fn resend_pending_validation_requests(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn resend_pending_validation_requests(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]Resend any RequestValidation packets that have not yet received enough signatures.
pub fn resend_pending_msgs(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn resend_pending_msgs(
&self
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]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)?;
pub fn handle_packet(
&mut self,
packet: Packet<A, S, BRBDT::Op>
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]
pub fn handle_packet(
&mut self,
packet: Packet<A, S, BRBDT::Op>
) -> Result<Vec<Packet<A, S, BRBDT::Op>>, Error<A, S, BRBDT::ValidationError>>
[src]handles an incoming BRB Packet.
Trait Implementations
impl<A: Actor<S>, SA: SigningActor<A, S>, S: Sig, BRBDT: BRBDataType<A>> Default for DeterministicBRB<A, SA, S, BRBDT>
[src]
impl<A: Actor<S>, SA: SigningActor<A, S>, S: Sig, BRBDT: BRBDataType<A>> Default for DeterministicBRB<A, SA, S, BRBDT>
[src]Auto Trait Implementations
impl<A, SA, S, BRBDT> RefUnwindSafe for DeterministicBRB<A, SA, S, BRBDT> where
A: RefUnwindSafe,
BRBDT: RefUnwindSafe,
S: RefUnwindSafe,
SA: RefUnwindSafe,
<BRBDT as BRBDataType<A>>::Op: RefUnwindSafe,
impl<A, SA, S, BRBDT> Send for DeterministicBRB<A, SA, S, BRBDT> where
A: Send,
BRBDT: Send,
S: Send,
SA: Send,
<BRBDT as BRBDataType<A>>::Op: Send,
impl<A, SA, S, BRBDT> Sync for DeterministicBRB<A, SA, S, BRBDT> where
A: Sync,
BRBDT: Sync,
S: Sync,
SA: Sync,
<BRBDT as BRBDataType<A>>::Op: Sync,
impl<A, SA, S, BRBDT> Unpin for DeterministicBRB<A, SA, S, BRBDT> where
A: Unpin,
BRBDT: Unpin,
SA: Unpin,
<BRBDT as BRBDataType<A>>::Op: Unpin,
impl<A, SA, S, BRBDT> UnwindSafe for DeterministicBRB<A, SA, S, BRBDT> where
A: RefUnwindSafe + UnwindSafe,
BRBDT: UnwindSafe,
S: RefUnwindSafe,
SA: UnwindSafe,
<BRBDT as BRBDataType<A>>::Op: RefUnwindSafe + UnwindSafe,