hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HCE::handlers::Handler Class Reference

#include <Handler.hpp>

Inheritance diagram for HCE::handlers::Handler:
Collaboration diagram for HCE::handlers::Handler:

Public Member Functions

 Handler (const std::string &name, zmq::context_t &context, const std::string &clientIdentity, const std::string &connectionString, int64_t startedAt, unsigned char logPriority, const std::string &iniFile="")
virtual ~Handler ()
void shutdown (void)
 Get handler instance name.
std::string getName (void)

Static Public Member Functions

static void * main (void *that)

Protected Member Functions

void setName (const std::string &name)
 <Set handler instance name
void setClientIdentity (const std::string &clientIdentity)
 Get client ID.
std::string getClientIdentity (void)
 Set start time mark.
void setStartedAt (int64_t startedAt)
 Get start time mark.
int64_t getStartedAt (void)
 Set log priority level.
void setLogPriority (unsigned int logPriority)
 Get log priority level.
unsigned int getLogPriority (void)
 Set ini file name.
void setIniFile (const std::string &iniFile)
 Get ini file name.
std::string getIniFile (void)
 Set ZMQ connections rebuild tries max number.
void setBindTriesMaxNumber (const unsigned int &bindTriesMaxNumber)
 Get ZMQ connections rebuild tries max number.
unsigned int getBindTriesMaxNumber (void)
 Set ZMQ connections rebuild tries delay.
void setBindTriesDelay (const unsigned int &bindTriesDelay)
 Get ZMQ connections rebuild tries delay.
unsigned int getBindTriesDelay (void)
 Set ZMQ connection string.
void setConnectionString (const std::string &connectionString)
 Get ZMQ connection string.
std::string getConnectionString (void)
 Set flag for polling condition.
void setInProgress (bool in_progress)
 Get flag for polling condition.
bool getInProgress (void) const
 Set poll timeout value.
void setPollTimeout (unsigned int pollTimeout)
 Get poll timeout value.
unsigned int getPollTimeout (void)
 Set property interval between resend Property values.
void setPropertyInterval (unsigned int propertyInterval)
 Get property interval between resend Property values.
unsigned int getPropertyInterval (void)
 Set interval between dump run-time variables.
void setDumpInterval (unsigned int dumpInterval)
 Get interval between dump run-time variables.
unsigned int getDumpInterval (void)
 Set flag for allowed restore variables use dump.
void setDumpAllowRestore (unsigned int dumpAllowRestore)
 Get interval between dump run-time variables.
unsigned int getDumpAllowRestore (void)
void logFlush (unsigned int priority=NODE_LOG_MODE_DEFAULT)
 Node init from file.
void initHandler (const std::string &iniFile, LoggerStream &logger)
void handleAdminMessage (void)
void processAdminMessage (zmsg &msg)
virtual std::string processAdminCommands (std::string &command, std::string &parameters)
void rebuildAdminClientSocket (void)
bool rebuildServerConnection (zmq::socket_t *&sock_p, const std::string &connectionString, const int type)
void rebuildClientConnection (zmq::socket_t *&sock_p, const std::string &connectionString, const int type, const std::string &identity="")
bool rebuildClientConnection (zmq::socket_t *&sock_p, const std::string &connectionString, const int type, const std::string &identity, int linger, const std::string &readyMessage="", const std::string &byeMessage=NODE_MSG_BYE)
void sendByeMessage (zmq::socket_t *&sock_p, const std::string &identity="", const std::string &byeMessage=NODE_MSG_BYE)
std::string getProperties (void)
 Get property information.
virtual std::string getPropertyInformation (void)
 Send periodical property values.
void sendPeriodicProperties (void)
 Safe create directories if necessary.
void createDirectories (const std::string &name)
 Get file name use for dump and restore properties values.
std::string getDumpFileName (void)
 Get file name use for dump and restore statistic values.
std::string getStatFileName (void)
 Dump properties variables.
bool dumpProperties (void)
 Dump run-time variables at regular intervals.
bool dumpRunTimeVariables (void)
virtual int initialize (void)=0
virtual void deinitialize (void)=0
virtual void * process (void)=0
void handleInternalMessage (void)
void handleExternalMessage (void)
void processControlMessage (zmsg &msg)
void processDataMessage (zmsg &msg)
void logPeriodicStatistics (void)
void heartbit (void)
void registerClient (const std::string &identity)
 Admin socket.

Protected Attributes

zmq::socket_t_inprocAdminSock
 Storage for run-time property variables.
HandlerProperties handlerProperties
 Storage for run-time statistic variables.
HandlerProperties statProperties
 ZMQ context.
zmq::context_t_context
std::bitset< 4 > _logMask
std::string _logTimeFormat
std::stringstream log
LoggerStream logger
 Main loop of sockets polling condition.
bool _inProgress
 Send out periodical property values to Admin class at regular intervals.
int64_t _propertyIntervalAt
 Dump run-time variables at regular intervals.
int64_t _dumpIntervalAt
 Dump dir name.
std::string _dumpDir

Detailed Description

Definition at line 43 of file Handler.hpp.

Constructor & Destructor Documentation

HCE::handlers::Handler::Handler ( const std::string &  name,
zmq::context_t context,
const std::string &  clientIdentity,
const std::string &  connectionString,
int64_t  startedAt,
unsigned char  logPriority,
const std::string &  iniFile = "" 
)
inline

<Set default value to allowed dump restore

<Read initialization data from file

<Check is allowed dump restore and restore if necessary

<Load handler properties values

Definition at line 45 of file Handler.hpp.

Here is the call graph for this function:

virtual HCE::handlers::Handler::~Handler ( )
inlinevirtual

<Save handler properties values

Definition at line 82 of file Handler.hpp.

Here is the call graph for this function:

Member Function Documentation

void HCE::handlers::Handler::createDirectories ( const std::string &  name)
inlineprotected

Get file name use for dump and restore properties values.

Definition at line 609 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::handlers::Handler::dumpProperties ( void  )
inlineprotected

Dump run-time variables at regular intervals.

<Save handler properties values

Definition at line 637 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::handlers::Handler::dumpRunTimeVariables ( void  )
inlineprotected

Definition at line 650 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getBindTriesDelay ( void  )
inlineprotected

Set ZMQ connection string.

Definition at line 178 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getBindTriesMaxNumber ( void  )
inlineprotected

Set ZMQ connections rebuild tries delay.

Definition at line 168 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getClientIdentity ( void  )
inlineprotected

Set start time mark.

Definition at line 128 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getConnectionString ( void  )
inlineprotected

Set flag for polling condition.

Definition at line 188 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getDumpAllowRestore ( void  )
inlineprotected

Definition at line 245 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getDumpFileName ( void  )
inlineprotected

Get file name use for dump and restore statistic values.

Definition at line 621 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getDumpInterval ( void  )
inlineprotected

Set flag for allowed restore variables use dump.

Definition at line 235 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getIniFile ( void  )
inlineprotected

Set ZMQ connections rebuild tries max number.

Definition at line 158 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool HCE::handlers::Handler::getInProgress ( void  ) const
inlineprotected

Set poll timeout value.

Definition at line 198 of file Handler.hpp.

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getLogPriority ( void  )
inlineprotected

Set ini file name.

Definition at line 148 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getName ( void  )
inline

Definition at line 111 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Handler::getPollTimeout ( void  )
inlineprotected

Set property interval between resend Property values.

Definition at line 210 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getProperties ( void  )
inlineprotected

Get property information.

Definition at line 574 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual std::string HCE::handlers::Handler::getPropertyInformation ( void  )
inlineprotectedvirtual
unsigned int HCE::handlers::Handler::getPropertyInterval ( void  )
inlineprotected

Set interval between dump run-time variables.

Definition at line 222 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t HCE::handlers::Handler::getStartedAt ( void  )
inlineprotected

Set log priority level.

Definition at line 138 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Handler::getStatFileName ( void  )
inlineprotected

Dump properties variables.

Definition at line 629 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::handleAdminMessage ( void  )
inlineprotected

<Fetch request message from inproc_admin socket

<Process message

<Send response message

Definition at line 328 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::handleExternalMessage ( void  )
protected
void HCE::handlers::Handler::heartbit ( void  )
protected
void HCE::handlers::Handler::initHandler ( const std::string &  iniFile,
LoggerStream logger 
)
inlineprotected

<Process Node's ini file

<Log some error of config file processing

<Log some error of config file processing

Definition at line 280 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::logFlush ( unsigned int  priority = NODE_LOG_MODE_DEFAULT)
inlineprotected

Node init from file.

Definition at line 249 of file Handler.hpp.

Here is the call graph for this function:

void HCE::handlers::Handler::logPeriodicStatistics ( void  )
protected
static void* HCE::handlers::Handler::main ( void *  that)
inlinestatic

Definition at line 102 of file Handler.hpp.

Here is the caller graph for this function:

virtual std::string HCE::handlers::Handler::processAdminCommands ( std::string &  command,
std::string &  parameters 
)
inlineprotectedvirtual
void HCE::handlers::Handler::processAdminMessage ( zmsg msg)
inlineprotected

<Fetch message Id

<Fetch message command

<Fetch message command parameters

<Fetch message source Identity

<Create response

<Parse command parameters and fetch log level value

<Parse command parameters and fetch log level value

<Parse command parameters and fetch property interval value

<Parse command parameters and fetch dump interval value

<Stop handler main loop as a result of processing of the "Shutdown" command for "Admin" handler

<Call admin commands processing redefined in the derivative class instance

<Insert response

<Insert messageSrcIdentity

Definition at line 341 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::processControlMessage ( zmsg msg)
protected
void HCE::handlers::Handler::processDataMessage ( zmsg msg)
protected
void HCE::handlers::Handler::rebuildAdminClientSocket ( void  )
inlineprotected

<Set identity for client socket

<Connect to inproc_admin socket

<Send ready message

Definition at line 424 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::rebuildClientConnection ( zmq::socket_t *&  sock_p,
const std::string &  connectionString,
const int  type,
const std::string &  identity = "" 
)
inlineprotected

Definition at line 497 of file Handler.hpp.

Here is the caller graph for this function:

bool HCE::handlers::Handler::rebuildClientConnection ( zmq::socket_t *&  sock_p,
const std::string &  connectionString,
const int  type,
const std::string &  identity,
int  linger,
const std::string &  readyMessage = "",
const std::string &  byeMessage = NODE_MSG_BYE 
)
inlineprotected

<Delete socket if already exists

<Send BYE message to the server (especially for the Paranoid Pirate Protocol implementations)

<Set identity to route responses from router

<Set linger for the socket (0 - to not wait at close time)

<Send READY message to the server (especially for the Paranoid Pirate Protocol implementations)

Definition at line 501 of file Handler.hpp.

Here is the call graph for this function:

bool HCE::handlers::Handler::rebuildServerConnection ( zmq::socket_t *&  sock_p,
const std::string &  connectionString,
const int  type 
)
inlineprotected

<Delete socket if already exists

<Try to bind

Definition at line 451 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::registerClient ( const std::string &  identity)
protected

Admin socket.

Reimplemented in HCE::handlers::DataServerProxy.

void HCE::handlers::Handler::sendByeMessage ( zmq::socket_t *&  sock_p,
const std::string &  identity = "",
const std::string &  byeMessage = NODE_MSG_BYE 
)
inlineprotected

<Send BYE message to the server (especially for the Paranoid Pirate Protocol implementations)

Definition at line 568 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::sendPeriodicProperties ( void  )
inlineprotected

Safe create directories if necessary.

<Log periodic properties sending

Definition at line 589 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setBindTriesDelay ( const unsigned int &  bindTriesDelay)
inlineprotected

Get ZMQ connections rebuild tries delay.

Definition at line 173 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setBindTriesMaxNumber ( const unsigned int &  bindTriesMaxNumber)
inlineprotected

Get ZMQ connections rebuild tries max number.

Definition at line 163 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setClientIdentity ( const std::string &  clientIdentity)
inlineprotected

Get client ID.

Definition at line 123 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setConnectionString ( const std::string &  connectionString)
inlineprotected

Get ZMQ connection string.

Definition at line 183 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setDumpAllowRestore ( unsigned int  dumpAllowRestore)
inlineprotected

Get interval between dump run-time variables.

Definition at line 240 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setDumpInterval ( unsigned int  dumpInterval)
inlineprotected

Get interval between dump run-time variables.

Definition at line 227 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setIniFile ( const std::string &  iniFile)
inlineprotected

Get ini file name.

Definition at line 153 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setInProgress ( bool  in_progress)
inlineprotected

Get flag for polling condition.

Definition at line 193 of file Handler.hpp.

Here is the caller graph for this function:

void HCE::handlers::Handler::setLogPriority ( unsigned int  logPriority)
inlineprotected

Get log priority level.

Definition at line 143 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setName ( const std::string &  name)
inlineprotected

<Set handler instance name

Set client ID

Definition at line 118 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setPollTimeout ( unsigned int  pollTimeout)
inlineprotected

Get poll timeout value.

Definition at line 203 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setPropertyInterval ( unsigned int  propertyInterval)
inlineprotected

Get property interval between resend Property values.

Definition at line 215 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::setStartedAt ( int64_t  startedAt)
inlineprotected

Get start time mark.

Definition at line 133 of file Handler.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Handler::shutdown ( void  )
inline

Get handler instance name.

Definition at line 106 of file Handler.hpp.

Here is the caller graph for this function:

Member Data Documentation

zmq::context_t& HCE::handlers::Handler::_context
protected

Definition at line 683 of file Handler.hpp.

std::string HCE::handlers::Handler::_dumpDir
protected

Definition at line 705 of file Handler.hpp.

int64_t HCE::handlers::Handler::_dumpIntervalAt
protected

Dump dir name.

Definition at line 704 of file Handler.hpp.

zmq::socket_t* HCE::handlers::Handler::_inprocAdminSock
protected

Storage for run-time property variables.

Definition at line 676 of file Handler.hpp.

bool HCE::handlers::Handler::_inProgress
protected

Send out periodical property values to Admin class at regular intervals.

Definition at line 698 of file Handler.hpp.

std::bitset<4> HCE::handlers::Handler::_logMask
protected

Definition at line 686 of file Handler.hpp.

std::string HCE::handlers::Handler::_logTimeFormat
protected

Definition at line 688 of file Handler.hpp.

int64_t HCE::handlers::Handler::_propertyIntervalAt
protected

Dump run-time variables at regular intervals.

Definition at line 701 of file Handler.hpp.

HandlerProperties HCE::handlers::Handler::handlerProperties
protected

Storage for run-time statistic variables.

Definition at line 679 of file Handler.hpp.

std::stringstream HCE::handlers::Handler::log
protected

Definition at line 690 of file Handler.hpp.

LoggerStream HCE::handlers::Handler::logger
protected

Main loop of sockets polling condition.

Definition at line 695 of file Handler.hpp.

HandlerProperties HCE::handlers::Handler::statProperties
protected

ZMQ context.

Definition at line 682 of file Handler.hpp.


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