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 | resolveConnection (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_ioContext |
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 27 of file ConfigClient.cpp.
ConfigClient::~ConfigClient | ( | ) |
Destructor: stops the publishing hread and retracts all published information
Definition at line 64 of file ConfigClient.cpp.
|
inline |
Definition at line 97 of file ConfigClient.hpp.
|
private |
Definition at line 150 of file ConfigClient.cpp.
void ConfigClient::publish | ( | ConnectionRegistration const & | connection | ) |
Publish information for a single connection
connectionId | The connection Id to be published |
uri | The uri corresponding to the connection id |
Definition at line 125 of file ConfigClient.cpp.
void ConfigClient::publish | ( | std::vector< ConnectionRegistration > const & | connections | ) |
Publish information for multiple connections
connectionId | A vector of connection Ids to be published |
uri | A vector of uris corresponding to the connection ids. This vector must be the same length as the connection id vector |
Definition at line 137 of file ConfigClient.cpp.
ConnectionResponse ConfigClient::resolveConnection | ( | 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 75 of file ConfigClient.cpp.
void ConfigClient::retract | ( | ) |
Retract all connection information that ew have published
Definition at line 196 of file ConfigClient.cpp.
void ConfigClient::retract | ( | const ConnectionId & | connectionId | ) |
Retract a single published connection
Definition at line 245 of file ConfigClient.cpp.
void ConfigClient::retract | ( | const std::vector< ConnectionId > & | connectionIds | ) |
Retract multiple published connections
connectionId | A vector of previously published connection Ids to be retracted |
Definition at line 251 of file ConfigClient.cpp.
|
private |
Definition at line 108 of file ConfigClient.hpp.
|
private |
Definition at line 103 of file ConfigClient.hpp.
|
private |
Definition at line 109 of file ConfigClient.hpp.
|
private |
Definition at line 102 of file ConfigClient.hpp.
|
private |
Definition at line 105 of file ConfigClient.hpp.
|
private |
Definition at line 106 of file ConfigClient.hpp.
|
private |
Definition at line 101 of file ConfigClient.hpp.
|
private |
Definition at line 107 of file ConfigClient.hpp.