[P2p - PubSub] force connection to a topic
At some point it is very likely that we cannot have balanced number of connection on all topic to which data-producer will need to push data.
We will thus need to rotate connections amongst peers to connect to topics of interests to push data.
So the plan is to expose a function in p2p.ml that allows to force a given number connections to a topic, even if it requires to close other connections in the process.
Forced connections will be most likely be protected from disconnection by the maintenance (see #3180 (closed) )
The function could have the following signature:
val force_connection :
net ->
topic ->
?timeout:Ptime.Span.t ->
min-connections:int ->
target-connections:int ->
(P2p_conn.t list, to-be-determined) result Lwt.t
It will try to establish target-connections to peers subscribed to the topic and it will resolve the returned promise if it manages to establish min-connection or in case of timeout.
Maybe in case of timeout we could/should return the successfully established connections in the error.