Enum safe_network::routing::Event[][src]

pub enum Event {
    MessageReceived {
        msg_id: MessageId,
        src: SrcLocation,
        dst: DstLocation,
        msg: Box<MessageReceived>,
    },
    MemberJoined {
        name: XorName,
        previous_name: Option<XorName>,
        age: u8,
    },
    MemberLeft {
        name: XorName,
        age: u8,
    },
    SectionSplit {
        elders: Elders,
        sibling_elders: Elders,
        self_status_change: NodeElderChange,
    },
    EldersChanged {
        elders: Elders,
        self_status_change: NodeElderChange,
    },
    RelocationStarted {
        previous_name: XorName,
    },
    Relocated {
        previous_name: XorName,
        new_keypair: Arc<Keypair>,
    },
    ServiceMsgReceived {
        msg_id: MessageId,
        msg: Box<ServiceMsg>,
        auth: AuthorityProof<ServiceAuth>,
        user: EndUser,
        dst_location: DstLocation,
    },
    AdultsChanged {
        remaining: BTreeSet<XorName>,
        added: BTreeSet<XorName>,
        removed: BTreeSet<XorName>,
    },
}
Expand description

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 from another Node.

Fields of MessageReceived

msg_id: MessageId

The message ID

src: SrcLocation

Source location

dst: DstLocation

Destination location

msg: Box<MessageReceived>

The message.

MemberJoined

A new peer joined our section.

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.

Fields of MemberLeft

name: XorName

Name of the node

age: u8

Age of the node

SectionSplit

Our section has split.

Fields of SectionSplit

elders: Elders

The Elders of our section.

sibling_elders: Elders

The Elders of the sibling section.

self_status_change: NodeElderChange

Promoted, demoted or no change?

EldersChanged

The set of elders in our section has changed.

Fields of EldersChanged

elders: Elders

The 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.

Fields of RelocationStarted

previous_name: XorName

Previous name before relocation

Relocated

This node has completed relocation to other section.

Fields of Relocated

previous_name: XorName

Old name before the relocation.

new_keypair: Arc<Keypair>

New keypair to be used after relocation.

ServiceMsgReceived

Received a message from a peer.

Fields of ServiceMsgReceived

msg_id: MessageId

The message ID

msg: Box<ServiceMsg>

The content of the message.

auth: AuthorityProof<ServiceAuth>

Data authority

user: EndUser

The end user that sent the message. Its xorname is derived from the client public key, and the socket_id maps against the actual socketaddr

dst_location: DstLocation

DstLocation for the message

AdultsChanged

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

Fields of AdultsChanged

remaining: BTreeSet<XorName>

Remaining Adults in our section.

added: BTreeSet<XorName>

New Adults in our section.

removed: BTreeSet<XorName>

Removed Adults in our section.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more