Struct brb::net::Net [−][src]
Net – a simulated in-memory network specialized to ed25519 keys.
Fields
procs: Vec<DeterministicBRB<Actor, SigningActor, Sig, DT>>
list of processes/nodes comprising the network.
delivered_packets: Vec<Packet<Actor, Sig, DT::Op>>
list of packets that have been delivered
n_packets: u64
total number of packets sent during network’s lifetime
invalid_packets: HashMap<Actor, u64>
count of invalid packets, by actor.
Implementations
impl<DT: BRBDT> Net<DT>
[src]
pub fn new() -> Self
[src]
Create a new BRBDT instance
pub fn members(&self) -> BTreeSet<Actor>
[src]
The largest set of procs who mutually see each other as peers are considered to be the network members.
pub fn actors(&self) -> BTreeSet<Actor>
[src]
Fetch the actors for each process in the network
pub fn initialize_proc(&mut self) -> Actor
[src]
Initialize a new process (NOTE: we do not request membership from the network automatically)
pub fn on_proc<V>(
&self,
actor: &Actor,
f: impl FnOnce(&DeterministicBRB<Actor, SigningActor, Sig, DT>) -> V
) -> Option<V>
[src]
&self,
actor: &Actor,
f: impl FnOnce(&DeterministicBRB<Actor, SigningActor, Sig, DT>) -> V
) -> Option<V>
Execute arbitrary code on a proc (immutable)
pub fn on_proc_mut<V>(
&mut self,
actor: &Actor,
f: impl FnOnce(&mut DeterministicBRB<Actor, SigningActor, Sig, DT>) -> V
) -> Option<V>
[src]
&mut self,
actor: &Actor,
f: impl FnOnce(&mut DeterministicBRB<Actor, SigningActor, Sig, DT>) -> V
) -> Option<V>
Execute arbitrary code on a proc (mutating)
pub fn proc_from_actor(
&self,
actor: &Actor
) -> Option<&DeterministicBRB<Actor, SigningActor, Sig, DT>>
[src]
&self,
actor: &Actor
) -> Option<&DeterministicBRB<Actor, SigningActor, Sig, DT>>
Get a (immutable) reference to a proc with the given actor.
pub fn proc_from_actor_mut(
&mut self,
actor: &Actor
) -> Option<&mut DeterministicBRB<Actor, SigningActor, Sig, DT>>
[src]
&mut self,
actor: &Actor
) -> Option<&mut DeterministicBRB<Actor, SigningActor, Sig, DT>>
Get a (mutable) reference to a proc with the given actor.
pub fn anti_entropy(&mut self)
[src]
Perform anti-entropy corrections on the network. Currently this is God mode implementations in that we don’t use message passing and we share process state directly.
pub fn deliver_packet(
&mut self,
packet: Packet<Actor, Sig, DT::Op>
) -> Vec<Packet<Actor, Sig, DT::Op>>
[src]
&mut self,
packet: Packet<Actor, Sig, DT::Op>
) -> Vec<Packet<Actor, Sig, DT::Op>>
Delivers a given packet to it’s target recipiant. The recipiant, upon processing this packet, may produce it’s own packets. This next set of packets are returned to the caller.
pub fn members_are_in_agreement(&self) -> bool
[src]
Checks if all members of the network have converged to the same state.
pub fn count_invalid_packets(&self) -> u64
[src]
counts number of invalid packets received by any proc
pub fn run_packets_to_completion(
&mut self,
packets: Vec<Packet<Actor, Sig, DT::Op>>
)
[src]
&mut self,
packets: Vec<Packet<Actor, Sig, DT::Op>>
)
Convenience function to iteratively deliver all packets along with any packets that may result from delivering a packet.
pub fn generate_msc(&self, chart_name: &str)
[src]
Generates an MSC file representing a packet sequence diagram. See http://www.mcternan.me.uk/mscgen/ See https://github.com/maidsafe/brb_membership#tests
Trait Implementations
impl<DT: Debug + BRBDT> Debug for Net<DT> where
DT::Op: Debug,
[src]
DT::Op: Debug,
impl<DT: BRBDT> Default for Net<DT>
[src]
Auto Trait Implementations
impl<DT> RefUnwindSafe for Net<DT> where
DT: RefUnwindSafe,
<DT as BRBDataType<Actor>>::Op: RefUnwindSafe,
DT: RefUnwindSafe,
<DT as BRBDataType<Actor>>::Op: RefUnwindSafe,
impl<DT> Send for Net<DT> where
DT: Send,
<DT as BRBDataType<Actor>>::Op: Send,
DT: Send,
<DT as BRBDataType<Actor>>::Op: Send,
impl<DT> Sync for Net<DT> where
DT: Sync,
<DT as BRBDataType<Actor>>::Op: Sync,
DT: Sync,
<DT as BRBDataType<Actor>>::Op: Sync,
impl<DT> Unpin for Net<DT> where
DT: Unpin,
<DT as BRBDataType<Actor>>::Op: Unpin,
DT: Unpin,
<DT as BRBDataType<Actor>>::Op: Unpin,
impl<DT> UnwindSafe for Net<DT> where
DT: UnwindSafe,
<DT as BRBDataType<Actor>>::Op: RefUnwindSafe + UnwindSafe,
DT: UnwindSafe,
<DT as BRBDataType<Actor>>::Op: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,