Enum sn_routing::Event[][src]

pub enum Event {
    MessageReceived {
        content: Bytes,
        src: SrcLocation,
        dst: DstLocation,
        proof: Option<Proof>,
        proof_chain: Option<SectionChain>,
    },
    MemberJoined {
        name: XorName,
        previous_name: Option<XorName>,
        age: u8,
    },
    MemberLeft {
        name: XorName,
        age: u8,
    },
    EldersChanged {
        prefix: Prefix,
        key: PublicKey,
        sibling_key: Option<PublicKey>,
        elders: BTreeSet<XorName>,
        self_status_change: NodeElderChange,
    },
    RelocationStarted {
        previous_name: XorName,
    },
    Relocated {
        previous_name: XorName,
        new_keypair: Arc<Keypair>,
    },
    RestartRequired,
    ClientMessageReceived {
        msg: Box<Message>,
        user: EndUser,
    },
    ClientLost(SocketAddr),
    AdultsChanged(BTreeSet<XorName>),
}

An Event raised by a Node or Client via its event sender.

These are sent by sn_routing to the library’s user. It allows the user to handle requests and responses, and to react to changes in the network.

Request and Response events from section locations are only raised once the majority has been reached, i.e. enough members of the section have sent the same message.

Variants

MessageReceived

Received a message.

Show fields

Fields of MessageReceived

content: Bytes

The content of the message.

src: SrcLocation

The source location that sent the message.

dst: DstLocation

The destination location that receives the message.

proof: Option<Proof>

The proof if the message was set to be aggregated at source.

proof_chain: Option<SectionChain>

The proof chain for the message, if any.

MemberJoined

A new peer joined our section.

Show fields

Fields of MemberJoined

name: XorName

Name of the node

previous_name: Option<XorName>

Previous name before relocation or None if it is a new node.

age: u8

Age of the node

MemberLeft

A node left our section.

Show fields

Fields of MemberLeft

name: XorName

Name of the node

age: u8

Age of the node

EldersChanged

The set of elders in our section has changed.

Show fields

Fields of EldersChanged

prefix: Prefix

The prefix of our section.

key: PublicKey

The BLS public key of our section.

sibling_key: Option<PublicKey>

The BLS public key of the sibling section, if this event is fired during a split. Otherwise None.

elders: BTreeSet<XorName>

The set of elders of our section.

self_status_change: NodeElderChange

Promoted, demoted or no change?

RelocationStarted

This node has started relocating to other section. Will be followed by Relocated when the node finishes joining the destination section.

Show fields

Fields of RelocationStarted

previous_name: XorName

Previous name before relocation

Relocated

This node has completed relocation to other section.

Show fields

Fields of Relocated

previous_name: XorName

Old name before the relocation.

new_keypair: Arc<Keypair>

New keypair to be used after relocation.

RestartRequired

Disconnected or failed to connect - restart required.

ClientMessageReceived

Received a message from a client node.

Show fields

Fields of ClientMessageReceived

msg: Box<Message>

The content of the message.

user: EndUser

The SocketAddr and PublicKey that sent the message. (Note: socket_id will be a random hash, to map against the actual socketaddr)

ClientLost(SocketAddr)

Failed in sending a message to client, or connection to client is lost

AdultsChanged(BTreeSet<XorName>)

Notify the current list of adult nodes, in case of churning.

Trait Implementations

impl Debug for Event[src]

Auto Trait Implementations

impl RefUnwindSafe for Event

impl Send for Event

impl Sync for Event

impl Unpin for Event

impl UnwindSafe for Event

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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