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::DispatcherServer Class Reference

#include <DispatcherServer.h>

+ Inheritance diagram for pdb::DispatcherServer:
+ Collaboration diagram for pdb::DispatcherServer:

Public Member Functions

 DispatcherServer (PDBLoggerPtr logger, std::shared_ptr< StatisticsDB > statisticsDB)
 
 ~DispatcherServer ()
 
void initialize ()
 
void registerHandlers (PDBServer &forMe) override
 
void registerStorageNodes (Handle< Vector< Handle< NodeDispatcherData >>> storageNodes)
 
void registerSet (std::pair< std::string, std::string > setAndDatabase, PartitionPolicyPtr partitionPolicy)
 
bool dispatchData (std::pair< std::string, std::string > setAndDatabase, std::string type, Handle< Vector< Handle< Object >>> toDispatch)
 
bool dispatchBytes (std::pair< std::string, std::string > setAndDatabase, std::string type, char *bytes, size_t numBytes)
 
void waitAllRequestsProcessed ()
 
- Public Member Functions inherited from pdb::ServerFunctionality
virtual void cleanup ()
 
template<class Functionality >
Functionality & getFunctionality ()
 
void recordServer (PDBServer &recordMe)
 
PDBWorkerPtr getWorker ()
 
PDBLoggerPtr getLogger ()
 

Private Member Functions

bool validateTypes (const std::string &databaseName, const std::string &setName, const std::string &typeName, std::string &errMsg)
 
bool sendData (std::pair< std::string, std::string > setAndDatabase, std::string type, Handle< NodeDispatcherData > destination, Handle< Vector< Handle< Object >>> toSend)
 
bool sendBytes (std::pair< std::string, std::string > setAndDatabase, std::string type, Handle< NodeDispatcherData > destination, char *bytes, size_t numBytes)
 
Handle< NodeDispatcherDatafindNode (NodeID nodeId)
 

Private Attributes

PDBLoggerPtr logger
 
std::shared_ptr< StatisticsDBstatisticsDB
 
Handle< Vector< Handle
< NodeDispatcherData > > > 
storageNodes
 
std::map< std::pair
< std::string, std::string >
, PartitionPolicyPtr
partitionPolicies
 
int numRequestsInProcessing = 0
 
pthread_mutex_t mutex
 

Detailed Description

Definition at line 50 of file DispatcherServer.h.

Constructor & Destructor Documentation

pdb::DispatcherServer::DispatcherServer ( PDBLoggerPtr  logger,
std::shared_ptr< StatisticsDB statisticsDB 
)

Definition at line 39 of file DispatcherServer.cc.

pdb::DispatcherServer::~DispatcherServer ( )

Definition at line 50 of file DispatcherServer.cc.

Member Function Documentation

bool pdb::DispatcherServer::dispatchBytes ( std::pair< std::string, std::string >  setAndDatabase,
std::string  type,
char *  bytes,
size_t  numBytes 
)

Definition at line 238 of file DispatcherServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::DispatcherServer::dispatchData ( std::pair< std::string, std::string >  setAndDatabase,
std::string  type,
Handle< Vector< Handle< Object >>>  toDispatch 
)

Dispatch a Vector of pdb::Object's to the correct StorageNodes as defined by that particular set's ParitionPolicy

Parameters
setAndDatabasename of the set and its corresponding database
toDispatchvector of pdb::Object's to dispatch
Returns
true on success

Definition at line 214 of file DispatcherServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Handle< NodeDispatcherData > pdb::DispatcherServer::findNode ( NodeID  nodeId)
private

Definition at line 356 of file DispatcherServer.cc.

+ Here is the caller graph for this function:

void pdb::DispatcherServer::initialize ( )

Definition at line 48 of file DispatcherServer.cc.

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

Inherited function from ServerFunctionality

Parameters
forMe

Implements pdb::ServerFunctionality.

Definition at line 54 of file DispatcherServer.cc.

+ Here is the call graph for this function:

void pdb::DispatcherServer::registerSet ( std::pair< std::string, std::string >  setAndDatabase,
PartitionPolicyPtr  partitionPolicy 
)

Register a new set for the dispatcher to handle.

Parameters
setAndDatabasename of the set and its corresponding database
partitionPolicypolicy by which to partition data for this set

Definition at line 199 of file DispatcherServer.cc.

+ Here is the caller graph for this function:

void pdb::DispatcherServer::registerStorageNodes ( Handle< Vector< Handle< NodeDispatcherData >>>  storageNodes)

Updates PartitionPolicy with a collection of all the available storage nodes in the cluster

Parameters
storageNodesa vector of the live storage nodes

Definition at line 185 of file DispatcherServer.cc.

bool pdb::DispatcherServer::sendBytes ( std::pair< std::string, std::string >  setAndDatabase,
std::string  type,
Handle< NodeDispatcherData destination,
char *  bytes,
size_t  numBytes 
)
private

Definition at line 314 of file DispatcherServer.cc.

+ Here is the caller graph for this function:

bool pdb::DispatcherServer::sendData ( std::pair< std::string, std::string >  setAndDatabase,
std::string  type,
Handle< NodeDispatcherData destination,
Handle< Vector< Handle< Object >>>  toSend 
)
private

Definition at line 297 of file DispatcherServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::DispatcherServer::validateTypes ( const std::string &  databaseName,
const std::string &  setName,
const std::string &  typeName,
std::string &  errMsg 
)
private

Validates with the catalog that a request to store data is correct

Returns
true if the type matches the known set

Definition at line 263 of file DispatcherServer.cc.

+ Here is the caller graph for this function:

void pdb::DispatcherServer::waitAllRequestsProcessed ( )
inline

Definition at line 98 of file DispatcherServer.h.

Member Data Documentation

PDBLoggerPtr pdb::DispatcherServer::logger
private

Definition at line 109 of file DispatcherServer.h.

pthread_mutex_t pdb::DispatcherServer::mutex
private

Definition at line 136 of file DispatcherServer.h.

int pdb::DispatcherServer::numRequestsInProcessing = 0
private

Definition at line 135 of file DispatcherServer.h.

std::map<std::pair<std::string, std::string>, PartitionPolicyPtr> pdb::DispatcherServer::partitionPolicies
private

Definition at line 112 of file DispatcherServer.h.

std::shared_ptr<StatisticsDB> pdb::DispatcherServer::statisticsDB
private

Definition at line 110 of file DispatcherServer.h.

Handle<Vector<Handle<NodeDispatcherData> > > pdb::DispatcherServer::storageNodes
private

Definition at line 111 of file DispatcherServer.h.


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