Struct sn_routing::Routing [−][src]
pub struct Routing { /* fields omitted */ }
Expand description
Interface for sending and receiving messages to and from other nodes, in the role of a full routing node.
A node is a part of the network that can route messages and be a member of a section or group
location. Its methods can be used to send requests and responses as either an individual
Node
or as a part of a section or group location. Their src
argument indicates that
role, and can be sn_messaging::SrcLocation::Node
or sn_messaging::SrcLocation::Section
.
Implementations
Creates new node using the given config and bootstraps it to the network.
NOTE: It’s not guaranteed this function ever returns. This can happen due to messages being lost in transit during bootstrapping, or other reasons. It’s the responsibility of the caller to handle this case, for example by using a timeout.
Sets the JoinsAllowed flag.
Starts a proposal that a node has gone offline. This can be done only by an Elder.
Signals the Elders of our section to test connectivity to a node.
Returns the ed25519 public key of this node.
Returns the ed25519 keypair of this node, as bytes.
Signs data
with the ed25519 key of this node.
pub async fn sign_as_elder(
&self,
data: &[u8],
public_key: &PublicKey
) -> Result<SignatureShare>
pub async fn sign_as_elder(
&self,
data: &[u8],
public_key: &PublicKey
) -> Result<SignatureShare>
Signs data
with the BLS secret key share of this node, if it has any. Returns
Error::MissingSecretKeyShare
otherwise.
Verifies signature
on data
with the ed25519 public key of this node.
Returns connection info of this node.
Returns the Section Signed Chain
Prefix of our section
Finds out if the given XorName matches our prefix.
Returns the information of all the current section elders.
Returns the elders of our section sorted by their distance to name
(closest first).
Returns the information of all the current section adults.
Returns the adults of our section sorted by their distance to name
(closest first).
If we are not elder or if there are no adults in the section, returns empty vec.
Returns the info about our section or None
if we are not joined yet.
Returns the info about other sections in the network known to us.
Returns the last known public key of the section with prefix
.
Returns the info about the section matching the name.
Send a message. Messages sent here, either section to section or node to node are signed and validated upon receipt by routing itself.
additional_proof_chain_key
is a key to be included in the signed chain attached to the
message. This is useful when the message contains some data that is signed with a different
key than the whole message is so that the recipient can verify such key.
Returns the current BLS public key set if this node has one, or
Error::InvalidState
otherwise.
Returns our section signed chain.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Routing
impl !UnwindSafe for Routing