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

Accepts client connections on a passive endpoint and receives their notifications. More...

#include <EbLfServer.hh>

Public Member Functions

 EbLfServer (const unsigned &verbose)
 Construct with default libfabric hints; nothing is opened until listen().
 
 EbLfServer (const unsigned &verbose, const std::map< std::string, std::string > &kwargs)
 Construct with libfabric hints built from kwargs (see Fabrics::Info); nothing is opened until listen().
 
 ~EbLfServer ()
 Delete all links, the receive completion queue, the event queue and the passive endpoint.
 
int listen (const std::string &addr, std::string &port, unsigned nLinks)
 Create a passive endpoint on addr:port and start listening with a backlog of nLinks.
 
int connect (EbLfSvrLink **, unsigned nLinks, int msTmo=-1)
 Accept one connection, waiting up to msTmo ms, and store a new EbLfSvrLink in the first argument.
 
int disconnect (EbLfSvrLink *)
 Delete the link and close its endpoint; the shared queues are deleted when no links remain.
 
void shutdown ()
 Delete the passive endpoint.
 
int pend (fi_cq_data_entry *, int msTmo)
 Get one receive completion into the entry.
 
int pend (void **context, int msTmo)
 Call pend(fi_cq_data_entry*, msTmo) and store the completion's op_context in context; it is stored even when no completion was read.
 
int pend (uint64_t *data, int msTmo)
 Call pend(fi_cq_data_entry*, msTmo) and store the completion's immediate data in data; it is stored even when no completion was read.
 
int poll (uint64_t *data)
 Read one receive completion in the current polling or waiting mode (see pend()) and store its immediate data in data (0 if none).
 
int pollEQ ()
 Read one event from the shared event queue without blocking.
 
int setupMr (void *region, size_t size)
 Register (or reuse) a memory region for size bytes at region on the passive endpoint's fabric; returns -1 if there is no passive endpoint.
 
uint64_t pending () const
 Return the shared pending word (incremented while pend() or a link's timed poll() is waiting).
 
uint64_t posting () const
 Return the shared posting word, a bit list of peer IDs currently posting.
 

Detailed Description

Accepts client connections on a passive endpoint and receives their notifications.

All links share one event queue and one receive completion queue.

Constructor & Destructor Documentation

◆ EbLfServer() [1/2]

Pds::Eb::EbLfServer::EbLfServer ( const unsigned &  verbose)

Construct with default libfabric hints; nothing is opened until listen().

◆ EbLfServer() [2/2]

Pds::Eb::EbLfServer::EbLfServer ( const unsigned &  verbose,
const std::map< std::string, std::string > &  kwargs 
)

Construct with libfabric hints built from kwargs (see Fabrics::Info); nothing is opened until listen().

◆ ~EbLfServer()

Pds::Eb::EbLfServer::~EbLfServer ( )

Delete all links, the receive completion queue, the event queue and the passive endpoint.

Member Function Documentation

◆ connect()

int Pds::Eb::EbLfServer::connect ( EbLfSvrLink **  ,
unsigned  nLinks,
int  msTmo = -1 
)

Accept one connection, waiting up to msTmo ms, and store a new EbLfSvrLink in the first argument.

The shared event queue and receive completion queue (nLinks times the provider receive size) are created on first use. Returns 0 or an error number.

◆ disconnect()

int Pds::Eb::EbLfServer::disconnect ( EbLfSvrLink *  )

Delete the link and close its endpoint; the shared queues are deleted when no links remain.

Does nothing for a null link; always returns FI_SUCCESS.

◆ listen()

int Pds::Eb::EbLfServer::listen ( const std::string &  addr,
std::string &  port,
unsigned  nLinks 
)

Create a passive endpoint on addr:port and start listening with a backlog of nLinks.

If port is empty, the OS chooses a port and it is written back into port. Returns 0 or an error number.

◆ pend() [1/3]

int Pds::Eb::EbLfServer::pend ( fi_cq_data_entry *  ,
int  msTmo 
)

Get one receive completion into the entry.

The server polls first; after 1 ms without a completion it returns -FI_EAGAIN and switches to blocking waits of msTmo ms, going back to polling after a completion. Returns the positive completion count, -FI_EAGAIN, -FI_ENOTCONN if a client disconnected, or another negative error.

◆ pend() [2/3]

int Pds::Eb::EbLfServer::pend ( uint64_t *  data,
int  msTmo 
)
inline

Call pend(fi_cq_data_entry*, msTmo) and store the completion's immediate data in data; it is stored even when no completion was read.

◆ pend() [3/3]

int Pds::Eb::EbLfServer::pend ( void **  context,
int  msTmo 
)
inline

Call pend(fi_cq_data_entry*, msTmo) and store the completion's op_context in context; it is stored even when no completion was read.

◆ pending()

uint64_t Pds::Eb::EbLfServer::pending ( ) const
inline

Return the shared pending word (incremented while pend() or a link's timed poll() is waiting).

◆ poll()

int Pds::Eb::EbLfServer::poll ( uint64_t *  data)

Read one receive completion in the current polling or waiting mode (see pend()) and store its immediate data in data (0 if none).

Returns the positive count, -FI_EAGAIN, -FI_ENOTCONN if a client disconnected, or another negative error.

◆ pollEQ()

int Pds::Eb::EbLfServer::pollEQ ( )

Read one event from the shared event queue without blocking.

Returns -FI_ENOTCONN for an FI_SHUTDOWN from a known link (or if there is no queue), -FI_ENOKEY for one from an unknown endpoint, the queue error for other events or read errors, and FI_SUCCESS when no event is available.

◆ posting()

uint64_t Pds::Eb::EbLfServer::posting ( ) const
inline

Return the shared posting word, a bit list of peer IDs currently posting.

◆ setupMr()

int Pds::Eb::EbLfServer::setupMr ( void *  region,
size_t  size 
)

Register (or reuse) a memory region for size bytes at region on the passive endpoint's fabric; returns -1 if there is no passive endpoint.

◆ shutdown()

void Pds::Eb::EbLfServer::shutdown ( )

Delete the passive endpoint.


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