gusto 97c3076e57
DA: Feasability test for large number of udp connections (#5)
* Client and server setup for testing increasing number of connections over udp

* Add results and conclusions

* Move udp poc to the same directory as network poc

* Add readme for subnets pocs
2024-07-22 21:15:48 +03:00

36 lines
815 B
Python

import trio
from constants import DEBUG, NODE_PORT_BASE
from node import DANode
class DANetwork:
"""
Lightweight wrapper around a network of DA nodes.
Really just creates the network for now
"""
num_nodes: int
nodes: []
def __init__(self, nodes):
self.num_nodes = nodes
self.nodes = []
async def build(self, nursery, shutdown, disperse_send):
port_idx = NODE_PORT_BASE
for _ in range(self.num_nodes):
port_idx += 1
nursery.start_soon(
DANode.new,
port_idx,
self.nodes,
nursery,
shutdown,
disperse_send.clone(),
)
if DEBUG:
print("net built")
def get_nodes(self):
return self.nodes