#include <BroadcastServer.h>
|
| BroadcastServer (PDBLoggerPtr logger, ConfigurationPtr conf) |
|
| BroadcastServer (PDBLoggerPtr logger) |
|
| ~BroadcastServer () |
|
void | registerHandlers (PDBServer &forMe) override |
|
template<class MsgType , class PayloadType , class ResponseType > |
void | broadcast (Handle< MsgType > broadcastMsg, Handle< Vector< Handle< PayloadType >>> broadCastData, std::vector< std::string > receivers, std::function< void(Handle< ResponseType >, std::string)> successCallBack, std::function< void(std::string, std::string)> errorCallBack=[](std::string errMsg, std::string serverName){}) |
|
virtual void | cleanup () |
|
template<class Functionality > |
Functionality & | getFunctionality () |
|
void | recordServer (PDBServer &recordMe) |
|
PDBWorkerPtr | getWorker () |
|
PDBLoggerPtr | getLogger () |
|
An abstract class for ServerFunctionality that allows for the functionality to broadcast messages asynchronously.
Definition at line 31 of file BroadcastServer.h.
pdb::BroadcastServer::BroadcastServer |
( |
PDBLoggerPtr |
logger | ) |
|
pdb::BroadcastServer::~BroadcastServer |
( |
| ) |
|
template<class MsgType , class PayloadType , class ResponseType >
void pdb::BroadcastServer::broadcast |
( |
Handle< MsgType > |
broadcastMsg, |
|
|
Handle< Vector< Handle< PayloadType >>> |
broadCastData, |
|
|
std::vector< std::string > |
receivers, |
|
|
std::function< void(Handle< ResponseType >, std::string)> |
successCallBack, |
|
|
std::function< void(std::string, std::string)> |
errorCallBack = [](std::string errMsg, std::string serverName) { } |
|
) |
| |
A broadcast sends out a PDBObject along with an optional Vector<PDBObject> of data to a group of nodes. It will dispatch each of these messages in a seperate thread. Each thread will then call the proper callback, on either success or failure, when it receives a response. This function will block until all responses are received, either as successes or failures.
- Parameters
-
broadcastMsg | Initial PDBObject to send |
broadCastData | Additional PDBObject data to send |
receivers | Vector of "ip:host" of the nodes to receive the broadcast. |
successCallBack | Callback to be called on receiving a successful response from a receiver. Takes a response and "ip:host" as arguments |
errorCallBack | Callback to be called on receiving a erroneous response from a receiver. Takes an error msg and "ip:host" as arguments |
Definition at line 41 of file BroadcastServerTemplate.cc.
template<class DataType >
Handle< DataType > pdb::BroadcastServer::deepCopy |
( |
const Handle< DataType > & |
original | ) |
|
|
private |
void pdb::BroadcastServer::registerHandlers |
( |
PDBServer & |
forMe | ) |
|
|
overridevirtual |
pthread_mutex_t pdb::BroadcastServer::connection_mutex |
|
protected |
std::mutex pdb::BroadcastServer::lock |
|
private |
The documentation for this class was generated from the following files: