salsa 0.7.1
|
salsa node class More...
#include <NodeZyre.hh>
Public Member Functions | |
NodeZyre (std::string name="") | |
Construct Zyre node with provided name (and packetizer) | |
virtual | ~NodeZyre () |
Destruct Zyre node. | |
virtual int | init () |
First function. | |
virtual int | exec () |
Main function. | |
virtual int | finish () |
Last function. | |
void | addSocket (std::shared_ptr< SocketZyre > socket) |
std::vector< std::shared_ptr< SocketZyre > > | sockets () const |
void | addSocket (zsock_t *pSocket) |
zsock_t * | socketExternal (int i) |
Rerturns external socket. | |
void | handleExternalZmq (zmsg_t *pMsg, zsock_t *pSocket) |
void | type (std::string t) |
Sets type of current node. | |
std::string | type () |
Returns type of current node. | |
void | clusterAlias (std::string n) |
Sets Cluster alias. | |
std::string | clusterAlias () |
Returns Cluster alias. | |
void | jobInfoGroupName (std::string n) |
Sets JobInfo Group name. | |
std::string | jobInfoGroupName () |
Returns JobInfo Group name. | |
void | jobInfoBrokerUrl (std::string url) |
Sets JobInfo broker url. | |
std::string | jobInfoBrokerUrl () |
Returns JobInfo broker url. | |
void | submitClientUrl (std::string url) |
Sets Submit client url. | |
std::string | submitClientUrl () |
Returns Submit client url. | |
void | jobInfoClientUrl (std::string url) |
Sets JobInfo client url. | |
std::string | jobInfoClientUrl () |
Returns JobInfo client url. | |
virtual void | print () const |
virtual void | json (Json::Value &root) |
virtual void | publish () |
std::string | name () const |
Returns node name. | |
void | name (std::string n) |
Sets node name. | |
std::string | uuid () const |
Returns node UUID. | |
void | uuid (std::string uuid) |
Sets node uuid. | |
std::string | hostname () const |
Returns node hostname. | |
void | hostname (std::string h) |
Sets node hostname. | |
std::weak_ptr< Node > | parent () const |
Returns parent node. | |
void | parent (std::weak_ptr< Node > node) |
Sets parent. | |
std::vector< std::shared_ptr< Node > > | nodes () const |
Returns nodes. | |
void | add (std::shared_ptr< Node > node) |
Adds node to the list of nodes. | |
void | add (std::shared_ptr< Publisher > pPublisher) |
Adds publisher to the node. | |
std::shared_ptr< Node > | find (std::string name) const |
Find node by name. | |
void | removeByUUID (std::string uuid) |
Remove node by uuid. | |
std::vector< std::shared_ptr< Publisher > > | publishers () const |
Returns publishers. | |
NodeInfo * | nodeInfo () const |
Returns Node Info. | |
virtual void | pipe (void *pipe) |
Setter for pipe. | |
void | timeout (int t) |
Sets timeout. | |
int | timeout () const |
Returns timeout. | |
virtual void * | wait () |
zpoller_t * | poller () const |
PollerZmq * | pollerZmq () const |
bool | terminated () const |
Flag if actor should be terminated. | |
Static Public Member Functions | |
static void | SalsaActorFn (zsock_t *pPipe, void *pArgv) |
static void | SalsaActorForkFn (zsock_t *pPipe, void *pArgv) |
Actor function with fork capability. | |
static std::sig_atomic_t | interrupted () |
Returns if salsa is interrupted. | |
static void | interrupted (std::sig_atomic_t sig) |
Setter salsa interruption. | |
static void | signalHandler (int signalNumber) |
Setter salsa interruption. | |
static std::shared_ptr< spdlog::logger > | getConsoleOutput () |
Get console output. | |
static void | setConsoleLevel (spdlog::level::level_enum level) |
Sets console log level. | |
Protected Attributes | |
NodeInfo * | mpNodeInfo {new NodeInfo()} |
Node Info. | |
std::weak_ptr< Node > | mpParent |
Parent node. | |
std::vector< std::shared_ptr< Node > > | mChildNodes = {} |
List of nodes. | |
std::vector< std::shared_ptr< Publisher > > | mPublishers = {} |
List of publishers. | |
zsock_t * | mpPipe = nullptr |
Zmq pipe socket. | |
PollerZmq * | mpPoller = nullptr |
Internal poller. | |
bool | mTerminated = false |
Flag if actor should be terminated. | |
int | mTimeout = -1 |
Poller timeout. | |
Static Private Member Functions | |
static void | actorProcwaitSupport_ (zsock_t *pipe, void *argv) |
Support actor method (used for PID waiting) | |
Private Attributes | |
std::vector< std::shared_ptr< SocketZyre > > | mSockets {} |
List of zyre sockets. | |
std::vector< zsock_t * > | mZmqSockets {} |
List of zmq sockets. | |
NodeManagerZyre * | mpNodeManager = nullptr |
Job manager. | |
std::string | mType |
Current node type. | |
std::string | mClusterAlias {"local"} |
Cluster alias. | |
std::string | mJobInfoGroupName |
JobInfo Group name. | |
std::string | mJobInfoBrokerUrl |
JobInfo broker url (salsa-broker –in ...) | |
std::string | mJobInfoClientUrl |
JobInfo url for client (salsa-broker –out ...) | |
std::string | mSubmitClientUrl |
Submit url for client. | |
int | mJobCheckTimeout |
Job check timeout. | |
Static Private Attributes | |
static std::sig_atomic_t | msInterrupted = 0 |
flag if salsa is interrupted | |
static std::shared_ptr< spdlog::logger > | mspConsoleLogger = spdlog::stdout_color_mt("salsa") |
Pointer to spd logger. | |
salsa node class
Definition at line 20 of file NodeZyre.hh.
Salsa::NodeZyre::NodeZyre | ( | std::string | name = "" | ) |
Construct Zyre node with provided name (and packetizer)
Constructor
Definition at line 12 of file NodeZyre.cc.
References Salsa::ActorZmq::ActorZmq(), Salsa::Node::name(), and Salsa::Node::Node().
|
virtual |
Destruct Zyre node.
Destructor
Definition at line 21 of file NodeZyre.cc.
References Salsa::Node::mpNodeInfo, mpNodeManager, mSockets, and mZmqSockets.
|
staticprivateinherited |
Support actor method (used for PID waiting)
Definition at line 311 of file ActorZmq.cc.
References Salsa::Log::fd(), and Salsa::Log::write().
Referenced by SalsaActorForkFn().
|
inlineinherited |
Adds node to the list of nodes.
Definition at line 53 of file Node.hh.
References mChildNodes.
Referenced by Salsa::NodeZyre::addSocket().
|
inlineinherited |
void Salsa::NodeZyre::addSocket | ( | std::shared_ptr< SocketZyre > | socket | ) |
Adding zyre socket
Definition at line 255 of file NodeZyre.cc.
References Salsa::Node::add(), and mSockets.
void Salsa::NodeZyre::addSocket | ( | zsock_t * | pSocket | ) |
|
inline |
|
inline |
|
virtual |
Main function.
Exec
Reimplemented from Salsa::ActorZmq.
Definition at line 111 of file NodeZyre.cc.
References Salsa::Message::event(), handleExternalZmq(), Salsa::Actor::interrupted(), mJobCheckTimeout, mpNodeManager, Salsa::ActorZmq::mpPipe, mSockets, Salsa::ActorZmq::mTerminated, mZmqSockets, sockets(), type(), Salsa::Message::uuid(), and Salsa::ActorZmq::wait().
|
inherited |
Find node by name.
Returns node by name
Definition at line 103 of file Node.cc.
References mChildNodes, and name().
|
virtual |
Last function.
Finish
Reimplemented from Salsa::ActorZmq.
Definition at line 242 of file NodeZyre.cc.
|
inlinestaticinherited |
Get console output.
Definition at line 21 of file Object.hh.
References mspConsoleLogger.
Referenced by Salsa::ConfigZyre::apply().
void Salsa::NodeZyre::handleExternalZmq | ( | zmsg_t * | pMsg, |
zsock_t * | pSocket ) |
Handle message from external zmq Example: SUBMITTER
Doing special and most used case zmsSockets==1
TODO redirector ID
Definition at line 288 of file NodeZyre.cc.
References mJobInfoClientUrl, mpNodeManager, mZmqSockets, sockets(), Salsa::Job::submitterSocketID(), and Salsa::Job::submitterSocketIndex().
Referenced by exec().
|
inlineinherited |
Returns node hostname.
Definition at line 37 of file Node.hh.
References mpNodeInfo.
Referenced by Salsa::NodeZyre::init().
|
inlineinherited |
|
virtual |
First function.
Init
important for signal handling
Init
Reimplemented from Salsa::ActorZmq.
Definition at line 42 of file NodeZyre.cc.
References Salsa::Node::hostname(), Salsa::ActorZmq::init(), mClusterAlias, mJobCheckTimeout, mJobInfoBrokerUrl, mJobInfoGroupName, mpNodeManager, Salsa::ActorZmq::mpPoller, mSockets, mSubmitClientUrl, mType, and mZmqSockets.
|
inlinestaticinherited |
Returns if salsa is interrupted.
Definition at line 35 of file Actor.hh.
References msInterrupted.
Referenced by Salsa::ActorZmq::exec(), Salsa::NodeZyre::exec(), Salsa::ActorZmq::SalsaActorFn(), and signalHandler().
|
inlinestaticinherited |
|
inline |
Returns JobInfo broker url.
Definition at line 55 of file NodeZyre.hh.
References mJobInfoBrokerUrl.
|
inline |
|
inline |
Returns JobInfo client url.
Definition at line 63 of file NodeZyre.hh.
References mJobInfoClientUrl.
|
inline |
|
inline |
Returns JobInfo Group name.
Definition at line 51 of file NodeZyre.hh.
References mJobInfoGroupName.
|
inline |
|
virtualinherited |
|
inlineinherited |
Returns node name.
Definition at line 33 of file Node.hh.
References mpNodeInfo.
Referenced by find(), and Salsa::NodeZyre::NodeZyre().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Setter for pipe.
Setting pipe socket
Implements Salsa::Actor.
Definition at line 359 of file ActorZmq.cc.
References mpPipe, and mpPoller.
Referenced by SalsaActorFn().
|
inherited |
|
inherited |
|
virtualinherited |
Prints node info
Definition at line 81 of file Node.cc.
References mChildNodes, mpNodeInfo, mpParent, and mPublishers.
|
virtualinherited |
|
inlineinherited |
|
inherited |
Remove node by uuid.
Removes node by uuid
Definition at line 120 of file Node.cc.
References mChildNodes.
|
staticinherited |
Actor function engine
Definition at line 22 of file ActorZmq.cc.
References ActorZmq(), exec(), finish(), init(), Salsa::Actor::interrupted(), pipe(), and terminated().
|
staticinherited |
Actor function with fork capability.
Definition at line 57 of file ActorZmq.cc.
References actorProcwaitSupport_(), Salsa::Log::add(), Salsa::Log::create(), Salsa::Log::fd(), and Salsa::Log::spd().
Referenced by Salsa::NodeManagerZyre::addTaskSlot().
|
inlinestaticinherited |
|
staticinherited |
Setter salsa interruption.
Function for handling signals
Definition at line 19 of file Actor.cc.
References interrupted(), and msInterrupted.
Referenced by Salsa::ActorZmq::init().
|
inline |
std::vector< std::shared_ptr< SocketZyre > > Salsa::NodeZyre::sockets | ( | ) | const |
Returns list of sockets
Definition at line 270 of file NodeZyre.cc.
References mSockets.
Referenced by exec(), and handleExternalZmq().
|
inline |
|
inline |
|
inlineinherited |
Flag if actor should be terminated.
Definition at line 40 of file ActorZmq.hh.
References mTerminated.
Referenced by SalsaActorFn().
|
inlineinherited |
|
inlineinherited |
|
inline |
|
inline |
Sets type of current node.
Definition at line 41 of file NodeZyre.hh.
References mType.
Referenced by exec().
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Waiting for event
Definition at line 426 of file ActorZmq.cc.
References mpPipe, mpPoller, mTerminated, and mTimeout.
Referenced by exec(), and Salsa::NodeZyre::exec().
|
protectedinherited |
|
private |
Cluster alias.
Definition at line 70 of file NodeZyre.hh.
Referenced by clusterAlias(), clusterAlias(), and init().
|
private |
|
private |
JobInfo broker url (salsa-broker –in ...)
Definition at line 72 of file NodeZyre.hh.
Referenced by init(), jobInfoBrokerUrl(), and jobInfoBrokerUrl().
|
private |
JobInfo url for client (salsa-broker –out ...)
Definition at line 73 of file NodeZyre.hh.
Referenced by handleExternalZmq(), jobInfoClientUrl(), and jobInfoClientUrl().
|
private |
JobInfo Group name.
Definition at line 71 of file NodeZyre.hh.
Referenced by init(), jobInfoGroupName(), and jobInfoGroupName().
|
protectedinherited |
Node Info.
Definition at line 72 of file Node.hh.
Referenced by hostname(), hostname(), name(), name(), Node(), nodeInfo(), print(), uuid(), uuid(), ~Node(), and Salsa::NodeZyre::~NodeZyre().
|
private |
Job manager.
Definition at line 68 of file NodeZyre.hh.
Referenced by exec(), handleExternalZmq(), init(), and ~NodeZyre().
|
protectedinherited |
|
protectedinherited |
Zmq pipe socket.
Definition at line 48 of file ActorZmq.hh.
Referenced by Salsa::NodeZyre::exec(), pipe(), and wait().
|
protectedinherited |
Internal poller.
Definition at line 49 of file ActorZmq.hh.
Referenced by ActorZmq(), Salsa::NodeZyre::init(), pipe(), poller(), pollerZmq(), wait(), and ~ActorZmq().
|
protectedinherited |
|
staticprivateinherited |
flag if salsa is interrupted
Definition at line 44 of file Actor.hh.
Referenced by interrupted(), interrupted(), and signalHandler().
|
private |
List of zyre sockets.
Definition at line 66 of file NodeZyre.hh.
Referenced by addSocket(), exec(), init(), sockets(), and ~NodeZyre().
|
staticprivateinherited |
Pointer to spd logger.
Definition at line 32 of file Object.hh.
Referenced by getConsoleOutput(), and setConsoleLevel().
|
private |
Submit url for client.
Definition at line 74 of file NodeZyre.hh.
Referenced by init(), submitClientUrl(), and submitClientUrl().
|
protectedinherited |
Flag if actor should be terminated.
Definition at line 50 of file ActorZmq.hh.
Referenced by exec(), Salsa::NodeZyre::exec(), terminated(), and wait().
|
protectedinherited |
|
private |
Current node type.
Definition at line 69 of file NodeZyre.hh.
|
private |
List of zmq sockets.
Definition at line 67 of file NodeZyre.hh.
Referenced by addSocket(), exec(), handleExternalZmq(), init(), socketExternal(), and ~NodeZyre().