Skip to content

Query network state through LocalStateQuery mini-protocol #5033

Open
@coot

Description

@coot

In the first instance we will make it possible to query node-to-node state through LocalStateQuery mini-protocol (part of the node-to-client suite).

data ConnectionManagerState peeraddr = ConnectionManagerState {
    connectionMap                 :: Map (ConnectionId peeraddr) AbstractState,
    -- ^ map of connections, without outbound connections in
    -- `ReservedOutboundSt` state.

    registeredOutboundConnections :: Set peeraddr
    -- ^ set of outbound connections in `ReserverdOutboundSt` state.
  }
  deriving (Eq, Show)


data InboundState peeraddr = InboundState {
    remoteHotSet  :: !(Set (ConnectionId peeraddr)),
    remoteWarmSet :: !(Set (ConnectionId peeraddr)),
    remoteColdSet :: !(Set (ConnectionId peeraddr)),
    remoteIdleSet :: !(Set (ConnectionId peeraddr))
  }
  deriving (Eq, Show)

data OutboundState peeraddr = OutboundState {
    coldPeers :: Set peeraddr,
    warmPeers :: Set peeraddr,
    hotPeers  :: Set peeraddr
  }
  deriving (Eq, Show)


data NetworkState peeraddr = NetworkState {
    connectionManagerState :: ConnectionManagerState peeraddr,
    inboundGovernorState   :: InboundState peeraddr,
    outboundGovernorState  :: OutboundState peeraddr
  }
  deriving (Eq, Show)

At a later stage, the NetworkState will be extended with Handshake results.
This work will be merged / released once #5007 is merged.

TODOs

  • provide a CDDL spec for NetworkState CBOR encoding

Possible Future Extensions

  • add handshake versions & version data
  • add node-to-client data about inbound connections
  • a new mini-protocol which allows to subscribe to network state changes (this could be useful for monitoring local roots)
  • churn table
  • DeltaQ stats
  • Type of a peer: local root, ledger peer, big ledger peer, etc ...
  • network configuration

Branch

https://github.com/IntersectMBO/ouroboros-network/tree/coot/public-network-state

Metadata

Metadata

Assignees

Labels

diffusionIssues / PRs related to diffusion layer

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions