MatrixAI / Polykey

Polykey Core Library
https://polykey.com
GNU General Public License v3.0
29 stars 4 forks source link

Network Aware `NodeGraph` and `NodeConnectionManager` #783

Open amydevs opened 1 month ago

amydevs commented 1 month ago

Specification

With network segregation we will potentially have separate networks to keep track of. So when finding a node within a specific network, it will actively work against us to search through nodes that are not a part of that network. This will affect us when asking a node what nodes it's connected to and what nodes it has connected to during to nodes find process.

To streamline and optimise things, when responding to these requests we must filter for only the nodes in the requested network. There are two RPC calls affected by this, nodesClosestActiveConnectionsGet and nodesClosestLocalNodesGet. These RPC calls must take a network parameter on the input and only respond with nodes in that network as part of the output.

To achieve this we need to update the NodeConnectionManager to be aware of what networks each connections have access to as well as updating the NodeGraph to track the network each entry connected on. On top of that they need to filter for specific networks on request when getting lists of nodes.

All of this will be very important for the find node logic in the NodeManager.

We also may have to account for the security by checking if the connection requesting has access to said network. We could potentially make selection of network seamless by extracting that data from the connection and using it implicitly when filtering the responses.

Additional context

Related: #770

Tasks

  1. Update the NodeConnectionManager to be aware of the networks each connection has access to.
  2. Update the NodeGraph to be aware of the networks each entry is a part of.
  3. Update the RPC calls for requesting closest nodes and active connections to filter for a specific network.
  4. Review and conciser the security aspect of checking what network the requester has access to.
linear[bot] commented 1 month ago

ENG-374 Network Awareness of `NodeGraph`