DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
#include <ConfigClient.hpp>
Public Member Functions | |
ConfigClient (const std::string &server, const std::string &port, const std::string &session_name, std::chrono::milliseconds publish_interval) | |
~ConfigClient () | |
ConnectionResponse | resolve_connection (const ConnectionRequest &query, std::string session="") |
void | publish (ConnectionRegistration const &connection) |
void | publish (std::vector< ConnectionRegistration > const &connections) |
void | retract (const ConnectionId &connectionId) |
void | retract (const std::vector< ConnectionId > &connectionIds) |
void | retract () |
bool | is_connected () |
Private Member Functions | |
void | publish () |
Private Attributes | |
std::string | m_session |
net::io_context | m_io_context |
net::ip::basic_resolver< net::ip::tcp >::results_type | m_addr |
std::mutex | m_mutex |
std::set< ConnectionRegistration > | m_registered_connections |
std::thread | m_thread |
bool | m_active |
std::atomic< bool > | m_connected { false } |
Definition at line 34 of file ConfigClient.hpp.
ConfigClient::ConfigClient | ( | const std::string & | server, |
const std::string & | port, | ||
const std::string & | session_name, | ||
std::chrono::milliseconds | publish_interval ) |
Constructor: Starts a thread that publishes all know connection information once a second
server | Name/address of the connection server to publish to |
port | Port on the connection server to connect to |
session_name | Name of the current Session |
publish_interval | Time to wait between connection republish (keep-alive) |
Definition at line 37 of file ConfigClient.cpp.
ConfigClient::~ConfigClient | ( | ) |
Destructor: stops the publishing hread and retracts all published information
Definition at line 74 of file ConfigClient.cpp.
|
inline |
Definition at line 86 of file ConfigClient.hpp.
|
private |
Definition at line 161 of file ConfigClient.cpp.
void ConfigClient::publish | ( | ConnectionRegistration const & | connection | ) |
Definition at line 135 of file ConfigClient.cpp.
void ConfigClient::publish | ( | std::vector< ConnectionRegistration > const & | connections | ) |
Definition at line 147 of file ConfigClient.cpp.
ConnectionResponse ConfigClient::resolve_connection | ( | const ConnectionRequest & | query, |
std::string | session = "" ) |
Look up a connection in the connection server and return a list of uris that correspond to connection ids that match
query | Query string to send to the server. Query is a regular expression that can match with multiple connection ids |
session | The session that the requested connection is part of |
Definition at line 85 of file ConfigClient.cpp.
void ConfigClient::retract | ( | ) |
Retract all connection information that ew have published
Definition at line 207 of file ConfigClient.cpp.
void ConfigClient::retract | ( | const ConnectionId & | connectionId | ) |
Definition at line 256 of file ConfigClient.cpp.
void ConfigClient::retract | ( | const std::vector< ConnectionId > & | connectionIds | ) |
Retract multiple published connections
connectionIds | A vector of previously published connection Ids to be retracted |
Definition at line 262 of file ConfigClient.cpp.
|
private |
Definition at line 97 of file ConfigClient.hpp.
|
private |
Definition at line 92 of file ConfigClient.hpp.
|
private |
Definition at line 98 of file ConfigClient.hpp.
|
private |
Definition at line 91 of file ConfigClient.hpp.
|
private |
Definition at line 94 of file ConfigClient.hpp.
|
private |
Definition at line 95 of file ConfigClient.hpp.
|
private |
Definition at line 90 of file ConfigClient.hpp.
|
private |
Definition at line 96 of file ConfigClient.hpp.