Skip to content
Juvix imports

module arch.node.engines.net_registry_messages;

import arch.node.types.transport open;
import arch.node.types.basics open;
import arch.node.types.identities open;

Network Registry Messages

These are the messages that the Network Registry engine can receive/respond to.

Message interface

type NetworkRegistryMsg :=
| NetworkRegistryMsgNodeAdvert NodeAdvert
| NetworkRegistryMsgTopicAdvert TopicAdvert
| NetworkRegistryMsgGetNodeAdvertRequest NodeID
| NetworkRegistryMsgGetNodeAdvertReply GetNodeAdvertReply
| NetworkRegistryMsgGetTopicAdvertRequest TopicID
| NetworkRegistryMsgGetTopicAdvertReply GetTopicAdvertReply;

Message sequence diagrams


ExampleRequest & ExampleReply

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut purus eget sapien. Nulla facilisi.

sequenceDiagram
    participant NetworkRegistryClient
    participant NetworkRegistry

    NetworkRegistryClient ->> NetworkRegistry: ExampleRequest
    NetworkRegistry ->> NetworkRegistryClient: ExampleReplyOk

    NetworkRegistryClient ->> NetworkRegistry: ExampleRequest
    NetworkRegistry ->> NetworkRegistryClient: ExampleReplyErrorOne
Sequence Diagram: ExampleRequest & ExampleReply

Message types


NetworkRegistryMsgNodeAdvert

A NodeAdvert update from another node.


NodeAdvert

A self-signed node advertisement contains the node's cryptographic identity and transport addresses.

type NodeAdvert :=
mkNodeAdvert@{
id : NodeID;
addrs : List TransportAddress;
version : Nat;
created : AbsTime;
sig : Commitment;
};
Arguments
id
Node identity.
addrs
Transport addresses with preferences expressed as weights.
version
Version number (incremented at every change).
created
Time of creation.
sig
Signature by id.

TopicAdvert

A topic advertisement is signed by the topic creator, and contains the topic's cryptographic identity and the NodeID of a set of relay nodes that can be used to subscribe to the topic. These may be publishers, subscribers, or dedicated relay nodes for the topic.

type TopicAdvert :=
mkTopicAdvert@{
id : TopicID;
relays : List NodeID;
tags : List String;
version : Nat;
created : AbsTime;
sig : Commitment;
};

GetNodeAdvertRequest

Get NodeAdvert for the given NodeID.

Sender: any local engine.


GetNodeAdvertReply

Reply to a GetNodeAdvertRequest.


GetNodeAdvertReplyOk

Reply with locally available NodeAdvert.

GetNodeAdvertReplyOk : Type := NodeAdvert;

GetNodeAdvertReplyError

Error getting NodeAdvert.

type GetNodeAdvertReplyError := | GetNodeAdvertReplyErrorNotFound;

GetNodeAdvertReply

GetNodeAdvertReply : Type := Result GetNodeAdvertReplyError GetNodeAdvertReplyOk;

GetTopicAdvertRequest

Get TopicAdvert for the given TopicID.

Sender: any local engine.


GetTopicAdvertReply

Reply to a GetTopicAdvertRequest.

GetTopicAdvertReplyOk

Reply with locally available TopicAdvert.

GetTopicAdvertReplyOk : Type := TopicAdvert;

GetTopicAdvertReplyError

Error getting TopicAdvert.

type GetTopicAdvertReplyError := | GetTopicAdvertReplyErrorNotFound;

GetTopicAdvertReply

GetTopicAdvertReply : Type :=
Result GetTopicAdvertReplyError GetTopicAdvertReplyOk;

NetworkRegistryMsg

type NetworkRegistryMsg :=
| NetworkRegistryMsgNodeAdvert NodeAdvert
| NetworkRegistryMsgTopicAdvert TopicAdvert
| NetworkRegistryMsgGetNodeAdvertRequest NodeID
| NetworkRegistryMsgGetNodeAdvertReply GetNodeAdvertReply
| NetworkRegistryMsgGetTopicAdvertRequest TopicID
| NetworkRegistryMsgGetTopicAdvertReply GetTopicAdvertReply;

Engine components