A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pdb::BroadcastServer Class Reference

#include <BroadcastServer.h>

+ Inheritance diagram for pdb::BroadcastServer:
+ Collaboration diagram for pdb::BroadcastServer:

Public Member Functions

 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){})
 
- Public Member Functions inherited from pdb::ServerFunctionality
virtual void cleanup ()
 
template<class Functionality >
Functionality & getFunctionality ()
 
void recordServer (PDBServer &recordMe)
 
PDBWorkerPtr getWorker ()
 
PDBLoggerPtr getLogger ()
 

Protected Attributes

PDBLoggerPtr logger
 
ConfigurationPtr conf
 
pthread_mutex_t connection_mutex
 

Private Member Functions

template<class DataType >
Handle< DataType > deepCopy (const Handle< DataType > &original)
 

Private Attributes

std::mutex lock
 

Detailed Description

An abstract class for ServerFunctionality that allows for the functionality to broadcast messages asynchronously.

Definition at line 31 of file BroadcastServer.h.

Constructor & Destructor Documentation

pdb::BroadcastServer::BroadcastServer ( PDBLoggerPtr  logger,
ConfigurationPtr  conf 
)

Definition at line 24 of file BroadcastServer.cc.

pdb::BroadcastServer::BroadcastServer ( PDBLoggerPtr  logger)

Definition at line 30 of file BroadcastServer.cc.

pdb::BroadcastServer::~BroadcastServer ( )

Definition at line 36 of file BroadcastServer.cc.

Member Function Documentation

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
broadcastMsgInitial PDBObject to send
broadCastDataAdditional PDBObject data to send
receiversVector of "ip:host" of the nodes to receive the broadcast.
successCallBackCallback to be called on receiving a successful response from a receiver. Takes a response and "ip:host" as arguments
errorCallBackCallback 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.

+ Here is the call graph for this function:

template<class DataType >
Handle< DataType > pdb::BroadcastServer::deepCopy ( const Handle< DataType > &  original)
private

Performs a deep copy on a PDBObject

Parameters
originalthe original PDBObject
Returns
a deep copy of the PDBOBject

Definition at line 206 of file BroadcastServerTemplate.cc.

void pdb::BroadcastServer::registerHandlers ( PDBServer forMe)
overridevirtual

Implements pdb::ServerFunctionality.

Reimplemented in pdb::DistributedStorageManagerServer.

Definition at line 40 of file BroadcastServer.cc.

Member Data Documentation

ConfigurationPtr pdb::BroadcastServer::conf
protected

Definition at line 83 of file BroadcastServer.h.

pthread_mutex_t pdb::BroadcastServer::connection_mutex
protected

Definition at line 84 of file BroadcastServer.h.

std::mutex pdb::BroadcastServer::lock
private

Definition at line 78 of file BroadcastServer.h.

PDBLoggerPtr pdb::BroadcastServer::logger
protected

Definition at line 82 of file BroadcastServer.h.


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