SyncProtocol

Struct SyncProtocol 

Source
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

Source

pub fn new(fanout: usize, max_hops: u8) -> Result<Self, CryptoError>

Create new sync protocol

Source

pub fn set_genesis(&self, genesis: GenesisBlock)

Set the Genesis Block

Source

pub fn register_peer(&self, node: MeshNode)

Register a peer node

Source

pub fn broadcast_threat(&self, fingerprint: CompactedThreatFingerprint)

Broadcast a threat fingerprint (gossip protocol)

This is the core of the hive-mind intelligence.

Source

pub fn broadcast_filter(&self, filter: SignedFilter)

Broadcast a signed filter

Source

pub fn take_outbound(&self) -> Vec<SyncMessage>

Get pending outbound messages (for network layer to transmit)

Source

pub fn receive(&self, message: SyncMessage)

Receive a sync message

Source

pub fn process_inbound(&self) -> Vec<CompactedThreatFingerprint>

Process received messages

Returns fingerprints to add to local immunity memory

Source

pub fn peer_count(&self) -> usize

Get active peer count

Source

pub fn message_count(&self) -> u64

Get message count

Source

pub fn node_id(&self) -> &str

Get node ID

Source

pub fn shutdown(&self)

Shutdown protocol

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V