Skip to content

Network Subsystem

Purpose

The Network Subsystem is responsible for sending and receiving messages to and from remote nodes.

Overview

The Network Subsystem consists of the following engines.

Router

The Router engine is responsible for spawning a Node Proxy instance for each remote node, and a Pub/Sub Topic instance for each pub/sub topic. It maintains a database of known NodeAdvert and TopicAdvert messages.

Node Proxy

A Node Proxy engine is responsible for communication with one specific remote node.

It performs transport selection, connection establishment and maintenance.

It forwards messages between local engine instances and Transport Connection engine instances.

Connections may be ephemeral or permanent. Ephemeral connections are established when the first message is sent to the node, or when the remote node initiates a connection, and not re-established automatically when the connection is lost. Permanent connections are established when the Node Proxy is started, and automatically re-established when the connection is lost.

The engine instance name corresponds to the remote NodeID.

Transport Connection

A Transport Protocol engine is responsible for accepting and initiating transport connections for one specific transport protocol, such as QUIC or TLS.

Transport Protocol

Pub/Sub Topic

A Pub/Sub Topic engine is responsible for topic-based publish/subscribe (pub/sub) message dissemination for a specific pub/sub topic.

The protocol allows a set of authorized publishers to publish messages in the topic, as well as local and remote engines to subscribe to it. Published messages are disseminated to all subscribers.

The engine instance name corresponds to the TopicID.

Storage

Diagrams

Spawn tree & message flow

flowchart TD

N(Node)

E1(Engine1)
E2(Engine2)
E3(Engine3)

subgraph Network Subsystem
  R(Router)

  subgraph NodeProxies
    NP1(NProxy-1)
    NP2(NProxy-2)
    NP3(NProxy-3)
  end

  subgraph PubSub
    T1(Topic-1)
    T2(Topic-2)
    T3(Topic-3)
  end

  subgraph Transport
    TP1(TProto-1)
    TP2(TProto-2)
    TP3(TProto-3)

    TC11(TConn-1-1)
    TC12(TConn-1-2)
    TC21(TConn-2-1)
    TC31(TConn-3-1)
    TC32(TConn-3-2)
  end
end

NET(Network)

%% Spawn tree

N -.-> R & TP1 & TP2 & TP3 & E1 & E2 & E3
R -.-> NP1 & NP2 & NP3 & T1 & T2 & T3
TP1 -.-> TC11 & TC12
TP2 -.-> TC21
TP3 -.-> TC31 & TC32

%% Message flow

%% Intra-node communacation between local engines
E1 -- Send --> E2

%% First message via R to open a connection
E2 -- NodeSend --> R -- Send --> NP2 -- Send --> TP2 -- Send --> TC21 --> NET
E2 -- TopicForward --> R -- Forward --> T1

%% Subsequent messages
E2 -- Send --> NP2
E2 -- Forward --> T1

T1 -- Send --> E3
T1 -- Send --> NP1 -- Send --> TP1 -- Send --> TC12 --> NET
Spawn tree & message flow: - dotted: spawn - solid: message send