salsa
0.4.0
|
salsa node class More...
#include <NodeZyre.hh>
Public Member Functions | |
NodeZyre (std::string name="") | |
Construct Zyre node with provided name (and packetizer) More... | |
virtual | ~NodeZyre () |
Destruct Zyre node. More... | |
virtual int | init () |
First function. More... | |
virtual int | exec () |
Main function. More... | |
virtual int | finish () |
Last function. More... | |
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 | 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. More... | |
void | removeByUUID (std::string uuid) |
Remove node by uuid. More... | |
std::vector< std::shared_ptr< Publisher > > | publishers () const |
Returns publishers. | |
NodeInfo * | nodeInfo () const |
Returns Node Info. | |
virtual void | pipe (void *pipe) |
Setter for pipe. More... | |
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. More... | |
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. | |
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 | 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. | |
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.
|
virtual |
Destruct Zyre node.
Destructor
Definition at line 19 of file NodeZyre.cc.
References Salsa::Node::mpNodeInfo, mpNodeManager, mSockets, and mZmqSockets.
void Salsa::NodeZyre::addSocket | ( | std::shared_ptr< SocketZyre > | socket | ) |
Adding zyre socket
Definition at line 243 of file NodeZyre.cc.
References Salsa::Node::add(), and mSockets.
void Salsa::NodeZyre::addSocket | ( | zsock_t * | pSocket | ) |
|
virtual |
Main function.
Exec
Exec
Reimplemented from Salsa::ActorZmq.
Definition at line 106 of file NodeZyre.cc.
References Salsa::Message::event(), handleExternalZmq(), Salsa::NodeManagerZyre::handleTaskPool(), Salsa::Actor::interrupted(), mJobCheckTimeout, mpNodeManager, Salsa::ActorZmq::mpPipe, mSockets, Salsa::ActorZmq::mTerminated, mZmqSockets, Salsa::NodeManagerZyre::onEnter(), Salsa::NodeManagerZyre::onExit(), Salsa::NodeManagerZyre::onWhisper(), Salsa::NodeManager::publish(), sockets(), Salsa::NodeManager::terminateFinishedJobs(), 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 Salsa::Node::mChildNodes, and Salsa::Node::name().
|
virtual |
Last function.
Finish
Finish
Reimplemented from Salsa::ActorZmq.
Definition at line 230 of file NodeZyre.cc.
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 276 of file NodeZyre.cc.
References Salsa::NodeManager::addTask(), Salsa::NodeManager::job(), mJobInfoClientUrl, mpNodeManager, mZmqSockets, Salsa::NodeManager::nSlots(), Salsa::NodeManager::print(), Salsa::NodeManager::publish(), sockets(), Salsa::Job::submitterSocketID(), Salsa::Job::submitterSocketIndex(), Salsa::NodeManager::terminateAllJobs(), and Salsa::NodeManager::terminateJob().
Referenced by exec().
|
virtual |
First function.
Init
important for signal handling
Init
Reimplemented from Salsa::ActorZmq.
Definition at line 40 of file NodeZyre.cc.
References Salsa::PollerZmq::add(), Salsa::NodeManager::addConsumer(), Salsa::NodeManager::addFeeder(), Salsa::NodeManager::addWorker(), Salsa::NodeManager::feeder(), Salsa::NodeManager::finishedJobTimeout(), Salsa::Node::hostname(), Salsa::ActorZmq::init(), mJobCheckTimeout, mJobInfoBrokerUrl, mJobInfoGroupName, mpNodeManager, Salsa::ActorZmq::mpPoller, mSockets, mSubmitClientUrl, mZmqSockets, Salsa::NodeManager::publisher(), and Salsa::NodeManager::worker().
|
virtualinherited |
Returns Node in json format
Definition at line 34 of file Node.cc.
References Salsa::Node::mChildNodes.
|
virtualinherited |
Setter for pipe.
Setting pipe socket
Implements Salsa::Actor.
Definition at line 359 of file ActorZmq.cc.
References Salsa::PollerZmq::add(), Salsa::ActorZmq::mpPipe, and Salsa::ActorZmq::mpPoller.
Referenced by Salsa::ActorZmq::SalsaActorFn().
|
inherited |
Returns zpoller
Definition at line 473 of file ActorZmq.cc.
References Salsa::ActorZmq::mpPoller, and Salsa::PollerZmq::poller().
|
inherited |
Returns PollerZmq
Definition at line 480 of file ActorZmq.cc.
References Salsa::ActorZmq::mpPoller.
Referenced by Salsa::NodeManagerZyre::addTaskSlot().
|
virtualinherited |
Prints node info
Definition at line 81 of file Node.cc.
References Salsa::Node::mChildNodes, Salsa::Node::mpNodeInfo, Salsa::Node::mpParent, and Salsa::Node::mPublishers.
|
virtualinherited |
|
inherited |
Remove node by uuid.
Removes node by uuid
Definition at line 120 of file Node.cc.
References Salsa::Node::mChildNodes.
|
staticinherited |
Actor function engine
Definition at line 22 of file ActorZmq.cc.
References Salsa::ActorZmq::exec(), Salsa::ActorZmq::finish(), Salsa::ActorZmq::init(), Salsa::Actor::interrupted(), Salsa::ActorZmq::pipe(), and Salsa::ActorZmq::terminated().
|
staticinherited |
Setter salsa interruption.
Function for handling signals
Definition at line 19 of file Actor.cc.
References Salsa::Actor::interrupted(), and Salsa::Actor::msInterrupted.
Referenced by Salsa::ActorZmq::init().
std::vector< std::shared_ptr< SocketZyre > > Salsa::NodeZyre::sockets | ( | ) | const |
Returns list of sockets
Definition at line 258 of file NodeZyre.cc.
References mSockets.
Referenced by exec(), and handleExternalZmq().
|
virtualinherited |
Waiting for event
Definition at line 426 of file ActorZmq.cc.
References Salsa::ActorZmq::mpPipe, Salsa::ActorZmq::mpPoller, Salsa::ActorZmq::mTerminated, Salsa::ActorZmq::mTimeout, Salsa::PollerZmq::poller(), and Salsa::PollerZmq::wait().
Referenced by Salsa::ActorZmq::exec(), and exec().