1 #ifndef artdaq_DAQrate_TokenSender_hh
2 #define artdaq_DAQrate_TokenSender_hh
4 #include "artdaq-core/Data/RawEvent.hh"
5 #include "artdaq-utilities/Plugins/MetricManager.hh"
6 #include "artdaq/DAQdata/Globals.hh"
7 #include "artdaq/DAQrate/detail/RequestMessage.hh"
8 #include "fhiclcpp/ParameterSet.h"
9 #include "fhiclcpp/types/Table.h"
11 #include <arpa/inet.h>
12 #include <netinet/in.h>
13 #include <sys/socket.h>
14 #include <sys/types.h>
37 fhicl::Atom<bool>
use_routing_manager{fhicl::Name{
"use_routing_manager"}, fhicl::Comment{
"True if using the Routing Manager"},
false};
39 fhicl::Atom<int>
routing_token_port{fhicl::Name{
"routing_token_port"}, fhicl::Comment{
"Port to send tokens on"}, 35555};
41 fhicl::Atom<std::string>
routing_token_host{fhicl::Name{
"routing_manager_hostname"}, fhicl::Comment{
"Hostname or IP of RoutingManager"},
"localhost"};
69 explicit TokenSender(
const fhicl::ParameterSet& pset);
102 std::atomic<bool> initialized_;
104 bool send_routing_tokens_;
107 std::string token_address_;
108 std::atomic<size_t> tokens_sent_;
109 uint32_t run_number_;
112 void setup_tokens_();
114 void send_routing_token_(
int nSlots,
int run_number,
int rank);
fhicl::Atom< bool > use_routing_manager
"use_routing_manager" (Default: false) : Whether to send tokens to a RoutingManager ...
fhicl::Atom< int > routing_token_port
"routing_token_port" (Default: 35555) : Port to send tokens on
fhicl::Atom< std::string > routing_token_host
"routing_manager_hostname" (Default: "localhost") : Hostname or IP of RoutingManager ...
TokenSender & operator=(TokenSender const &)=delete
Copy Assignment operator is deleted.
fhicl::WrappedTable< Config > Parameters
Used for ParameterSet validation (if desired)
void SendRoutingToken(int nSlots, int run_number, int rank=my_rank)
Send a RoutingToken message indicating that slots are available.
The TokenSender contains methods used to send data requests and Routing tokens.
Configuration for Routing token sending
size_t GetSentTokenCount() const
Get the count of number of tokens sent.
bool RoutingTokenSendsEnabled()
Determine if routing token sends are enabled.
virtual ~TokenSender()
TokenSender Destructor.
TokenSender()=delete
Default Constructor is deleted.
void SetRunNumber(uint32_t run)
Set the run number to be used in request messages.