HiveEvent

Enum HiveEvent 

Source
pub enum HiveEvent {
Show 18 variants PeerDiscovered { peer: HivePeer, }, PeerConnected { node_id: NodeId, }, PeerDisconnected { node_id: NodeId, reason: DisconnectReason, }, PeerLost { node_id: NodeId, }, EmergencyReceived { from_node: NodeId, }, AckReceived { from_node: NodeId, }, EventReceived { from_node: NodeId, event_type: EventType, }, DocumentSynced { from_node: NodeId, total_count: u64, }, MeshStateChanged { peer_count: usize, connected_count: usize, }, AllPeersAcked { ack_count: usize, }, PeerE2eeEstablished { peer_node_id: NodeId, }, PeerE2eeClosed { peer_node_id: NodeId, }, PeerE2eeMessageReceived { from_node: NodeId, data: Vec<u8>, }, PeerE2eeFailed { peer_node_id: NodeId, error: String, }, SecurityViolation { kind: SecurityViolationKind, source: Option<String>, }, MessageRelayed { origin_node: NodeId, relay_count: usize, hop_count: u8, }, DuplicateMessageDropped { origin_node: NodeId, seen_count: u32, }, MessageTtlExpired { origin_node: NodeId, hop_count: u8, },
}
Expand description

Events emitted by the HIVE mesh

These events notify observers about changes in mesh state, peer lifecycle, and document synchronization.

Variants§

§

PeerDiscovered

A new peer was discovered via BLE scanning

Fields

§peer: HivePeer

The discovered peer

§

PeerConnected

A peer connected to us (either direction)

Fields

§node_id: NodeId

Node ID of the connected peer

§

PeerDisconnected

A peer disconnected

Fields

§node_id: NodeId

Node ID of the disconnected peer

§reason: DisconnectReason

Reason for disconnection

§

PeerLost

A peer was removed due to timeout (stale)

Fields

§node_id: NodeId

Node ID of the lost peer

§

EmergencyReceived

An emergency event was received from a peer

Fields

§from_node: NodeId

Node ID that sent the emergency

§

AckReceived

An ACK event was received from a peer

Fields

§from_node: NodeId

Node ID that sent the ACK

§

EventReceived

A generic event was received from a peer

Fields

§from_node: NodeId

Node ID that sent the event

§event_type: EventType

Type of event

§

DocumentSynced

A document was synced with a peer

Fields

§from_node: NodeId

Node ID that we synced with

§total_count: u64

Updated total counter value

§

MeshStateChanged

Mesh state changed (peer count, connected count)

Fields

§peer_count: usize

Total number of known peers

§connected_count: usize

Number of connected peers

§

AllPeersAcked

All peers have acknowledged an emergency

Fields

§ack_count: usize

Number of peers that acknowledged

§

PeerE2eeEstablished

E2EE session established with a peer

Fields

§peer_node_id: NodeId

Node ID of the peer we established E2EE with

§

PeerE2eeClosed

E2EE session closed with a peer

Fields

§peer_node_id: NodeId

Node ID of the peer whose E2EE session closed

§

PeerE2eeMessageReceived

Received an E2EE encrypted message from a peer

Fields

§from_node: NodeId

Node ID of the sender

§data: Vec<u8>

Decrypted message data

§

PeerE2eeFailed

E2EE session failed to establish

Fields

§peer_node_id: NodeId

Node ID of the peer

§error: String

Error description

§

SecurityViolation

A security violation was detected

Fields

§kind: SecurityViolationKind

Type of violation

§source: Option<String>

Optional source identifier (node_id, BLE identifier, etc.)

§

MessageRelayed

A message was relayed to other peers

Fields

§origin_node: NodeId

Original sender of the message

§relay_count: usize

Number of peers the message was relayed to

§hop_count: u8

Current hop count

§

DuplicateMessageDropped

A duplicate message was detected and dropped

Fields

§origin_node: NodeId

Original sender of the message

§seen_count: u32

How many times we’ve seen this message

§

MessageTtlExpired

A message was dropped due to TTL expiration

Fields

§origin_node: NodeId

Original sender of the message

§hop_count: u8

Hop count when dropped

Implementations§

Source§

impl HiveEvent

Source

pub fn peer_discovered(peer: HivePeer) -> Self

Create a peer discovered event

Source

pub fn peer_connected(node_id: NodeId) -> Self

Create a peer connected event

Source

pub fn peer_disconnected(node_id: NodeId, reason: DisconnectReason) -> Self

Create a peer disconnected event

Source

pub fn peer_lost(node_id: NodeId) -> Self

Create a peer lost event (timeout)

Source

pub fn emergency_received(from_node: NodeId) -> Self

Create an emergency received event

Source

pub fn ack_received(from_node: NodeId) -> Self

Create an ACK received event

Source

pub fn event_received(from_node: NodeId, event_type: EventType) -> Self

Create a generic event received

Source

pub fn document_synced(from_node: NodeId, total_count: u64) -> Self

Create a document synced event

Source

pub fn peer_e2ee_established(peer_node_id: NodeId) -> Self

Create a peer E2EE established event

Source

pub fn peer_e2ee_closed(peer_node_id: NodeId) -> Self

Create a peer E2EE closed event

Source

pub fn peer_e2ee_message_received(from_node: NodeId, data: Vec<u8>) -> Self

Create a peer E2EE message received event

Source

pub fn peer_e2ee_failed(peer_node_id: NodeId, error: String) -> Self

Create a peer E2EE failed event

Source

pub fn security_violation( kind: SecurityViolationKind, source: Option<String>, ) -> Self

Create a security violation event

Trait Implementations§

Source§

impl Clone for HiveEvent

Source§

fn clone(&self) -> HiveEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HiveEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.