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

#include <Admin.hpp>

Inheritance diagram for HCE::handlers::Admin:
Collaboration diagram for HCE::handlers::Admin:

Public Member Functions

 Admin (std::string name, zmq::context_t &ctx, const std::string &clientIdentity, std::string connectionString, int64_t startedAt, unsigned char logPriority, const std::string &iniFile="")
 ~Admin ()
void stopClients (void)
- Public Member Functions inherited from 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="")
virtual ~Handler ()
void shutdown (void)
 Get handler instance name.
std::string getName (void)

Protected Member Functions

int initialize (void)
void deinitialize (void)
void * process (void)
void handleInternalMessage (void)
void handleExternalMessage (void)
void processDataMessage (zmsg &msg)
void processControlMessageInproc (zmsg &msg)
void processDataMessageInproc (zmsg &msg)
void registerClientInproc (const std::string &identity)
unsigned char processAdminRequest (zmsg &msg)
std::string processAdminCommands (std::string &command, std::string &parameters)
 Get property information.
std::string getPropertyInformation (void)
 Set stat request total.
void setStatRequestsTotal (unsigned int statRequestsTotal)
 Get stat request total.
unsigned int getStatRequestsTotal (void)
 Sockets.
- Protected Member Functions inherited from HCE::handlers::Handler
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)
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.
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)
void processControlMessage (zmsg &msg)
void logPeriodicStatistics (void)
void heartbit (void)
void registerClient (const std::string &identity)
 Admin socket.

Static Protected Member Functions

static std::vector< std::string > parseAdminRequest (const std::string &command)

Protected Attributes

zmq::socket_t_adminServerSock
 Queue of connected clients for inproc_admin.
std::vector< ClientWorkerItem_queueInproc
 Connected clients queue manager.
ClientsQueueManager_clientsManagerInproc
- Protected Attributes inherited from HCE::handlers::Handler
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

Additional Inherited Members

- Static Public Member Functions inherited from HCE::handlers::Handler
static void * main (void *that)

Detailed Description

Definition at line 27 of file Admin.hpp.

Constructor & Destructor Documentation

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

<Init all the rest

Definition at line 11 of file Admin.cpp.

Here is the call graph for this function:

HCE::handlers::Admin::~Admin ( )

Definition at line 19 of file Admin.cpp.

Here is the call graph for this function:

Member Function Documentation

void HCE::handlers::Admin::deinitialize ( void  )
protectedvirtual

Implements HCE::handlers::Handler.

Definition at line 45 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string HCE::handlers::Admin::getPropertyInformation ( void  )
protectedvirtual

Set stat request total.

Reimplemented from HCE::handlers::Handler.

Definition at line 356 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int HCE::handlers::Admin::getStatRequestsTotal ( void  )
protected

Sockets.

Definition at line 65 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::handleExternalMessage ( void  )
protected

<Fetch message from dataserver

<Process dataserver's message

<Data message

Reimplemented from HCE::handlers::Handler.

Definition at line 418 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::handleInternalMessage ( void  )
protected

<Fetch message from dataserver

<Process dataserver's message

<Control message

<Data message

Reimplemented from HCE::handlers::Handler.

Definition at line 69 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int HCE::handlers::Admin::initialize ( void  )
protectedvirtual

<Rebuild inproc_proxy connection

<Rebuild adminserver connection

<Init stat vars

Implements HCE::handlers::Handler.

Definition at line 23 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > HCE::handlers::Admin::parseAdminRequest ( const std::string &  command)
staticprotected

<Parse command string

<Split on parts

Definition at line 120 of file Admin.cpp.

Here is the caller graph for this function:

void * HCE::handlers::Admin::process ( void  )
protectedvirtual

<Enter main loop of processing of message

<Init polling pool

<Poll dataserver

<Handle adminserver socket's message

Implements HCE::handlers::Handler.

Definition at line 434 of file Admin.cpp.

Here is the call graph for this function:

std::string HCE::handlers::Admin::processAdminCommands ( std::string &  command,
std::string &  parameters 
)
protectedvirtual

Get property information.

<Process commands

<Get timeout of shutdown action (ms), 0 - default

<Wait timeout

<Stop admin handler main loop

<Make property information

<Parse command parameters and fetch log level value

<Make response

<Set new log priority

<Parse command parameters and fetch poll timeout value

<Parse poll timeout from parameters

<Make response

<Parse command parameters and fetch dump interval value

<Parse dump interval from parameters

<Make response

<Set new dump interval value

Reimplemented from HCE::handlers::Handler.

Definition at line 274 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char HCE::handlers::Admin::processAdminRequest ( zmsg msg)
protected

<Fetch the clientIdentity field

<Fetch message Id

<Fetch message body

<Parse message body, supposes minimum 3 items: 0 - DESTINATION HANDLER IDENTITY, 1 - COMMAND_NAME, 2 - PARAMETERS

<Parse command parameters

<External admin command for inproc handler Insert inproc destination identity

<Insert source message Id

<Insert command name

<Insert command parameters

<Insert source client identity

<Response message value

<Insert source client identity

<Insert source message Id

<Insert response message

<Response message value

<Wrong or not supported command

<Insert source message Id

<Insert response message

<Wrong or not supported command

<Insert source client identity

<Insert source message Id

<Insert response message

<Wrong incoming command message body format from manager or destination admin handler (class instance by name) not connected Insert source client identity

<Insert source message Id

<Insert error message

<Register total requests number

Definition at line 133 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::processControlMessageInproc ( zmsg msg)
protected

<Fetch the clientIdentity field

<Update clients property

<Invalid property message

<Invalid message type

Definition at line 94 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::processDataMessage ( zmsg msg)
protected

<Send admin request message to inproc client to handle admin message by destination handler

<Send okay response message, command was executed internally

<Send error response message - wrong format of requested command or another parse error, send error response message to manager

Reimplemented from HCE::handlers::Handler.

Definition at line 365 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::processDataMessageInproc ( zmsg msg)
protected

<Fetch the clientIdentity field

<Fetch message Id

<Fetch message body

<Fetch the source clientIdentity field

<Create new response message

<Insert client identity

<Insert source message Id

<Insert message body

<Send response to manager

Definition at line 386 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::registerClientInproc ( const std::string &  identity)
protected

Definition at line 88 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::setStatRequestsTotal ( unsigned int  statRequestsTotal)
protected

Get stat request total.

Definition at line 61 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void HCE::handlers::Admin::stopClients ( void  )

<Send NODE_MSG_STOP message for all clients connected to internal admin socket

<Create response message and fill with fields

<Send response

Definition at line 257 of file Admin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

zmq::socket_t* HCE::handlers::Admin::_adminServerSock
protected

Queue of connected clients for inproc_admin.

Definition at line 64 of file Admin.hpp.

ClientsQueueManager* HCE::handlers::Admin::_clientsManagerInproc
protected

Definition at line 67 of file Admin.hpp.

std::vector<ClientWorkerItem> HCE::handlers::Admin::_queueInproc
protected

Connected clients queue manager.

Definition at line 66 of file Admin.hpp.


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