artdaq  v3_12_02
artdaq::RoutingManagerPolicy Class Referenceabstract

The interface through which RoutingManagerCore obtains Routing Tables using received Routing Tokens. More...

#include <artdaq/RoutingPolicies/RoutingManagerPolicy.hh>

Inheritance diagram for artdaq::RoutingManagerPolicy:
artdaq::CapacityTestPolicy artdaq::NoOpPolicy artdaq::PreferSameHostPolicy artdaq::RoundRobinPolicy

Public Member Functions

 RoutingManagerPolicy (const fhicl::ParameterSet &ps)
 RoutingManagerPolicy Constructor. More...
 
virtual ~RoutingManagerPolicy ()=default
 Default virtual Destructor.
 
size_t GetReceiverCount () const
 Get the number of configured receivers. More...
 
size_t GetMaxNumberOfTokens () const
 Get the largest number of tokens that the RoutingManagerPolicy has seen at any one time. More...
 
size_t GetTokensUsedSinceLastUpdate () const
 Get the number of tokens that have been used since the last update. More...
 
void ResetTokensUsedSinceLastUpdate ()
 Reset the number of tokens used.
 
void AddReceiverToken (int rank, unsigned new_slots_free)
 Add a token to the token list. More...
 
void Reset ()
 Reset the policy, setting the next sequence ID to be used to 1, and removing any tokens.
 
Fragment::sequence_id_t GetNextSequenceID () const
 Get the next sequence ID to be routed. More...
 
size_t GetHeldTokenCount () const
 Get the number of tokens that are waiting to be used. More...
 
detail::RoutingPacket GetCurrentTable ()
 Create a RoutingPacket from currently-owned tokens. Used by EventBuilder and RequestBasedEventBuilder RoutingManagerMode. More...
 
detail::RoutingPacketEntry GetRouteForSequenceID (artdaq::Fragment::sequence_id_t seq, int requesting_rank)
 Get an artdaq::detail::RoutingPacketEntry for a given sequence ID and rank. Used by RequestBasedEventBuilder and DataFlow RoutingManagerMode. More...
 
detail::RoutingManagerMode GetRoutingMode () const
 Get the current RoutingManagerMode of this RoutingManager. More...
 
size_t GetCacheSize () const
 Get the size of the routing cache. For testing. More...
 
bool CacheHasRoute (artdaq::Fragment::sequence_id_t seq) const
 Determine whether the routing cache has a route for the given sequence ID. For testing. More...
 

Protected Member Functions

virtual void CreateRoutingTable (detail::RoutingPacket &tables)=0
 Generate entries to add to the given table. More...
 
virtual detail::RoutingPacketEntry CreateRouteForSequenceID (artdaq::Fragment::sequence_id_t seq, int requesting_rank)=0
 Generate a route for the given sequence ID and source rank. More...
 

Protected Attributes

std::deque< int > tokens_
 The list of tokens which are available for use.
 
std::atomic< size_t > tokens_used_since_last_update_
 Number of tokens consumed since last metric update.
 
Fragment::sequence_id_t next_sequence_id_
 The next sequence ID to be assigned.
 
std::unordered_set< int > receiver_ranks_
 Configured receiver (e.g. EventBuilder for BR->EB routing) ranks.
 
detail::RoutingManagerMode routing_mode_
 Current routing mode.
 

Detailed Description

The interface through which RoutingManagerCore obtains Routing Tables using received Routing Tokens.

Definition at line 21 of file RoutingManagerPolicy.hh.

Constructor & Destructor Documentation

artdaq::RoutingManagerPolicy::RoutingManagerPolicy ( const fhicl::ParameterSet &  ps)
explicit

RoutingManagerPolicy Constructor.

Parameters
psParameterSet used to configure the RoutingManagerPolicy
* RoutingManagerPolicy accepts the following Parameters:
* 

Definition at line 9 of file RoutingManagerPolicy.cc.

Member Function Documentation

void artdaq::RoutingManagerPolicy::AddReceiverToken ( int  rank,
unsigned  new_slots_free 
)

Add a token to the token list.

Parameters
rankRank that the token is from
new_slots_freeNumber of slots that are now free (should usually be 1)

Definition at line 37 of file RoutingManagerPolicy.cc.

bool artdaq::RoutingManagerPolicy::CacheHasRoute ( artdaq::Fragment::sequence_id_t  seq) const
inline

Determine whether the routing cache has a route for the given sequence ID. For testing.

Parameters
seqSequence ID to check
Returns
True if the sequence ID is in the cache

Definition at line 120 of file RoutingManagerPolicy.hh.

virtual detail::RoutingPacketEntry artdaq::RoutingManagerPolicy::CreateRouteForSequenceID ( artdaq::Fragment::sequence_id_t  seq,
int  requesting_rank 
)
protectedpure virtual

Generate a route for the given sequence ID and source rank.

Parameters
seqSequence ID to route
requesting_rankSource rank requesting routing information
Returns
An artdaq::detail::RoutingPacketEntry linking the sequence ID to a destination rank

Implemented in artdaq::PreferSameHostPolicy, artdaq::RoundRobinPolicy, artdaq::NoOpPolicy, and artdaq::CapacityTestPolicy.

virtual void artdaq::RoutingManagerPolicy::CreateRoutingTable ( detail::RoutingPacket tables)
protectedpure virtual

Generate entries to add to the given table.

Parameters
tablesThe RoutingPacket to add entries to

Implemented in artdaq::PreferSameHostPolicy, artdaq::RoundRobinPolicy, artdaq::NoOpPolicy, and artdaq::CapacityTestPolicy.

size_t artdaq::RoutingManagerPolicy::GetCacheSize ( ) const
inline

Get the size of the routing cache. For testing.

Returns
Size of the routing cache

Definition at line 114 of file RoutingManagerPolicy.hh.

artdaq::detail::RoutingPacket artdaq::RoutingManagerPolicy::GetCurrentTable ( )

Create a RoutingPacket from currently-owned tokens. Used by EventBuilder and RequestBasedEventBuilder RoutingManagerMode.

Returns
artdaq::detail::RoutingPacket created from tokens held by Routing Manager.

Definition at line 18 of file RoutingManagerPolicy.cc.

size_t artdaq::RoutingManagerPolicy::GetHeldTokenCount ( ) const
inline

Get the number of tokens that are waiting to be used.

Returns
size of the held tokens list

Definition at line 83 of file RoutingManagerPolicy.hh.

size_t artdaq::RoutingManagerPolicy::GetMaxNumberOfTokens ( ) const
inline

Get the largest number of tokens that the RoutingManagerPolicy has seen at any one time.

Returns
The largest number of tokens that the RoutingManagerPolicy has seen at any one time

Definition at line 49 of file RoutingManagerPolicy.hh.

Fragment::sequence_id_t artdaq::RoutingManagerPolicy::GetNextSequenceID ( ) const
inline

Get the next sequence ID to be routed.

Returns
Next sequence ID to be routed

Definition at line 77 of file RoutingManagerPolicy.hh.

size_t artdaq::RoutingManagerPolicy::GetReceiverCount ( ) const
inline

Get the number of configured receivers.

Returns
The size of the receiver_ranks list

Definition at line 43 of file RoutingManagerPolicy.hh.

artdaq::detail::RoutingPacketEntry artdaq::RoutingManagerPolicy::GetRouteForSequenceID ( artdaq::Fragment::sequence_id_t  seq,
int  requesting_rank 
)

Get an artdaq::detail::RoutingPacketEntry for a given sequence ID and rank. Used by RequestBasedEventBuilder and DataFlow RoutingManagerMode.

Parameters
seqSequence Number to get route for
requesting_rankRank to route for
Returns
artdaq::detail::RoutingPacketEntry connecting sequence ID to destination rank

Definition at line 79 of file RoutingManagerPolicy.cc.

detail::RoutingManagerMode artdaq::RoutingManagerPolicy::GetRoutingMode ( ) const
inline

Get the current RoutingManagerMode of this RoutingManager.

Returns
artdaq::detail::RoutingManagerMode value

Definition at line 107 of file RoutingManagerPolicy.hh.

size_t artdaq::RoutingManagerPolicy::GetTokensUsedSinceLastUpdate ( ) const
inline

Get the number of tokens that have been used since the last update.

Returns
Current value of the token counter

Definition at line 55 of file RoutingManagerPolicy.hh.


The documentation for this class was generated from the following files: