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.
BasicNetwork(Scheduler &s)
BasicNetwork & operator=(BasicNetwork const &)=delete
bool connect(Peer const &from, Peer const &to, duration const &delay=std::chrono::seconds{0})
Connect two peers.
auto links(Peer const &from)
Return the range of active links.
bool disconnect(Peer const &peer1, Peer const &peer2)
Break a link.
typename clock_type::duration duration
typename clock_type::time_point time_point
Digraph< Peer, link_type > links_
void send(Peer const &from, Peer const &to, Function &&f)
Send a message to a peer.
Digraph< Peer, link_type > const & graph() const
Return the underlying digraph.
BasicNetwork(BasicNetwork const &)=delete
bool connect(Vertex source, Vertex target, EdgeData e)
Connect two vertices.
bool disconnect(Vertex source, Vertex target)
Disconnect two vertices.
std::optional< EdgeData > edge(Vertex source, Vertex target) const
Return edge data between two vertices.
Simulated discrete-event scheduler.
cancel_token in(duration const &delay, Function &&f)
Schedule an event after a specified duration passes.
time_point now() const
Return the current network time.
beast::manual_clock< std::chrono::steady_clock > clock_type
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.