1#ifndef XRPL_TEST_CSF_BASICNETWORK_H_INCLUDED
2#define XRPL_TEST_CSF_BASICNETWORK_H_INCLUDED
4#include <test/csf/Digraph.h>
5#include <test/csf/Scheduler.h>
157 template <
class Function>
168 return links_.outEdges(from);
216template <
class Function>
220 auto link = links_.
edge(from, to);
228 if (auto l = links_.edge(from, to); l && l->established <= sent)
typename Clock::time_point time_point
typename Clock::duration duration
Peer to peer network simulator.
typename clock_type::duration duration
BasicNetwork(Scheduler &s)
void send(Peer const &from, Peer const &to, Function &&f)
Send a message to a peer.
BasicNetwork & operator=(BasicNetwork const &)=delete
bool disconnect(Peer const &peer1, Peer const &peer2)
Break a link.
auto links(Peer const &from)
Return the range of active links.
Digraph< Peer, link_type > links_
BasicNetwork(BasicNetwork const &)=delete
Digraph< Peer, link_type > const & graph() const
Return the underlying digraph.
typename clock_type::time_point time_point
bool connect(Peer const &from, Peer const &to, duration const &delay=std::chrono::seconds{0})
Connect two peers.
std::optional< EdgeData > edge(Vertex source, Vertex target) const
Return edge data between two vertices.
bool disconnect(Vertex source, Vertex target)
Disconnect two vertices.
bool connect(Vertex source, Vertex target, EdgeData e)
Connect two vertices.
Simulated discrete-event scheduler.
beast::manual_clock< std::chrono::steady_clock > clock_type
time_point now() const
Return the current network time.
cancel_token in(duration const &delay, Function &&f)
Schedule an event after a specified duration passes.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
link_type(bool inbound_, duration delay_, time_point established_)
A single peer in the simulation.