lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Eb::EbCtrbInBase Class Referenceabstract

Receives trigger result batches from the TEBs over libfabric server links, matches them with the contributor's pending input batches and calls process() for each matched event. More...

#include <EbCtrbInBase.hh>

Inherited by Drp::TebReceiverBase.

Public Member Functions

 EbCtrbInBase (const TebCtrbParams &)
 Keep a reference to the parameters and create the server transport from prms.verbose and prms.kwargs.
 
virtual ~EbCtrbInBase ()
 Free the result region.
 
int resetCounters ()
 Reset the batch, event, missing, bypass and no-progress counters; returns 0.
 
int startConnection (std::string &port)
 Listen on prms.ifAddr:port for up to MAX_TEBS TEB connections with EbLfServer::listen(); an empty port is replaced by the bound ephemeral port.
 
int connect (const std::shared_ptr< MetricExporter >)
 Register metrics with the exporter (if non-null) and accept one link per builder in prms.builders with linksConnect().
 
int configure (unsigned numBuffers)
 Forget left-over inputs and deferred results, then for each TEB link receive the result region size, (re)allocate the shared result region if the size changed, and register it and send its description with EbLfSvrLink::setupMr().
 
void unconfigure ()
 Does nothing; empty body.
 
void disconnect ()
 Call unconfigure(), then disconnect and drop all links.
 
void shutdown ()
 Call disconnect(), then shut down the transport.
 
void receiver (TebContributor &, std::atomic< bool > &running)
 Thread body: pin to prms.core[1], name the thread drp/TEBreceiver and repeatedly wait (100 ms each) for result batches and match them with the pending inputs of ctrb, until running becomes false.
 
virtual void process (const ResultDgram &result, unsigned index)=0
 Pure virtual: handle the result of one event; index is the buffer index of the matching input datagram.
 

Detailed Description

Receives trigger result batches from the TEBs over libfabric server links, matches them with the contributor's pending input batches and calls process() for each matched event.

Abstract: a subclass supplies process().

Constructor & Destructor Documentation

◆ EbCtrbInBase()

Pds::Eb::EbCtrbInBase::EbCtrbInBase ( const TebCtrbParams &  )

Keep a reference to the parameters and create the server transport from prms.verbose and prms.kwargs.

◆ ~EbCtrbInBase()

virtual Pds::Eb::EbCtrbInBase::~EbCtrbInBase ( )
virtual

Free the result region.

Member Function Documentation

◆ configure()

int Pds::Eb::EbCtrbInBase::configure ( unsigned  numBuffers)

Forget left-over inputs and deferred results, then for each TEB link receive the result region size, (re)allocate the shared result region if the size changed, and register it and send its description with EbLfSvrLink::setupMr().

The result buffer size is the region size divided by numBuffers. Returns 0, ENOMEM, -1 if the TEBs ask for different sizes, or the first link error.

◆ connect()

int Pds::Eb::EbCtrbInBase::connect ( const std::shared_ptr< MetricExporter >  )

Register metrics with the exporter (if non-null) and accept one link per builder in prms.builders with linksConnect().

Returns 0 or the first error.

◆ disconnect()

void Pds::Eb::EbCtrbInBase::disconnect ( )

Call unconfigure(), then disconnect and drop all links.

◆ process()

virtual void Pds::Eb::EbCtrbInBase::process ( const ResultDgram &  result,
unsigned  index 
)
pure virtual

Pure virtual: handle the result of one event; index is the buffer index of the matching input datagram.

Called from the receiver thread for each input matched with a result, and with a locally built persist result for inputs that bypassed the TEBs.

Implemented in Drp::TebReceiverBase.

◆ receiver()

void Pds::Eb::EbCtrbInBase::receiver ( TebContributor &  ,
std::atomic< bool > &  running 
)

Thread body: pin to prms.core[1], name the thread drp/TEBreceiver and repeatedly wait (100 ms each) for result batches and match them with the pending inputs of ctrb, until running becomes false.

Throws a C string if a TEB connection is lost (-FI_ENOTCONN) or the same negative error occurs twice in a row.

◆ resetCounters()

int Pds::Eb::EbCtrbInBase::resetCounters ( )

Reset the batch, event, missing, bypass and no-progress counters; returns 0.

◆ shutdown()

void Pds::Eb::EbCtrbInBase::shutdown ( )

Call disconnect(), then shut down the transport.

◆ startConnection()

int Pds::Eb::EbCtrbInBase::startConnection ( std::string &  port)

Listen on prms.ifAddr:port for up to MAX_TEBS TEB connections with EbLfServer::listen(); an empty port is replaced by the bound ephemeral port.

Returns 0 or the listen error.

◆ unconfigure()

void Pds::Eb::EbCtrbInBase::unconfigure ( )

Does nothing; empty body.


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