pub struct SyncProtocol { /* private fields */ }Expand description
Sync Protocol - Gossip-based Hive Mind
Implements epidemic/gossip protocol for rapid threat propagation.
Implementations§
Source§impl SyncProtocol
impl SyncProtocol
Sourcepub fn set_genesis(&self, genesis: GenesisBlock)
pub fn set_genesis(&self, genesis: GenesisBlock)
Set the Genesis Block
Sourcepub fn register_peer(&self, node: MeshNode)
pub fn register_peer(&self, node: MeshNode)
Register a peer node
Sourcepub fn broadcast_threat(&self, fingerprint: CompactedThreatFingerprint)
pub fn broadcast_threat(&self, fingerprint: CompactedThreatFingerprint)
Broadcast a threat fingerprint (gossip protocol)
This is the core of the hive-mind intelligence.
Sourcepub fn broadcast_filter(&self, filter: SignedFilter)
pub fn broadcast_filter(&self, filter: SignedFilter)
Broadcast a signed filter
Sourcepub fn take_outbound(&self) -> Vec<SyncMessage>
pub fn take_outbound(&self) -> Vec<SyncMessage>
Get pending outbound messages (for network layer to transmit)
Sourcepub fn receive(&self, message: SyncMessage)
pub fn receive(&self, message: SyncMessage)
Receive a sync message
Sourcepub fn process_inbound(&self) -> Vec<CompactedThreatFingerprint>
pub fn process_inbound(&self) -> Vec<CompactedThreatFingerprint>
Process received messages
Returns fingerprints to add to local immunity memory
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get active peer count
Sourcepub fn message_count(&self) -> u64
pub fn message_count(&self) -> u64
Get message count
Auto Trait Implementations§
impl !Freeze for SyncProtocol
impl !RefUnwindSafe for SyncProtocol
impl Send for SyncProtocol
impl Sync for SyncProtocol
impl Unpin for SyncProtocol
impl UnwindSafe for SyncProtocol
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more