salsa  0.4.0
Salsa::NodeZyre Class Reference

salsa node class More...

#include <NodeZyre.hh>

Inheritance diagram for Salsa::NodeZyre:
Salsa::Node Salsa::ActorZmq Salsa::Actor Salsa::Object

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 jobInfoBrokerUrl (std::string url)
 Sets JobInfo broker url.
 
std::string jobInfoBrokerUrl ()
 Returns JobInfo broker 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::weak_ptr< Nodeparent () 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< Nodefind (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
 
PollerZmqpollerZmq () 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< NodempParent
 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.
 
PollerZmqmpPoller = 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.
 
NodeManagerZyrempNodeManager = nullptr
 Job manager.
 
std::string mJobInfoBrokerUrl
 JobInfo broker url (salsa-broker –in ...)
 
std::string mJobInfoClientUrl
 JobInfo url for client (salsa-broker –out ...)
 
int mJobCheckTimeout
 Job check timeout.
 

Detailed Description

Constructor & Destructor Documentation

◆ NodeZyre()

Salsa::NodeZyre::NodeZyre ( std::string  name = "")

Construct Zyre node with provided name (and packetizer)

Constructor

Definition at line 12 of file NodeZyre.cc.

◆ ~NodeZyre()

Salsa::NodeZyre::~NodeZyre ( )
virtual

Destruct Zyre node.

Destructor

Definition at line 19 of file NodeZyre.cc.

References Salsa::Node::mpNodeInfo, mpNodeManager, mSockets, and mZmqSockets.

Member Function Documentation

◆ addSocket() [1/2]

void Salsa::NodeZyre::addSocket ( std::shared_ptr< SocketZyre socket)

Adding zyre socket

Definition at line 235 of file NodeZyre.cc.

References Salsa::Node::add(), and mSockets.

◆ addSocket() [2/2]

void Salsa::NodeZyre::addSocket ( zsock_t *  pSocket)

Returns list of zmq sockets

Definition at line 258 of file NodeZyre.cc.

References mZmqSockets.

◆ exec()

◆ find()

std::shared_ptr< Node > Salsa::Node::find ( std::string  name) const
inherited

Find node by name.

Returns node by name

Definition at line 113 of file Node.cc.

References Salsa::Node::mChildNodes, and Salsa::Node::name().

◆ finish()

int Salsa::NodeZyre::finish ( )
virtual

Last function.

Finish

Finish

Reimplemented from Salsa::ActorZmq.

Definition at line 222 of file NodeZyre.cc.

◆ handleExternalZmq()

void Salsa::NodeZyre::handleExternalZmq ( zmsg_t *  pMsg,
zsock_t *  pSocket 
)

◆ init()

◆ json()

void Salsa::Node::json ( Json::Value &  root)
virtualinherited

Returns Node in json format

Definition at line 34 of file Node.cc.

Referenced by Salsa::Node::publish().

◆ pipe()

void Salsa::ActorZmq::pipe ( void *  )
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().

◆ poller()

zpoller_t * Salsa::ActorZmq::poller ( ) const
inherited

Returns zpoller

Definition at line 473 of file ActorZmq.cc.

References Salsa::ActorZmq::mpPoller, and Salsa::PollerZmq::poller().

◆ pollerZmq()

PollerZmq * Salsa::ActorZmq::pollerZmq ( ) const
inherited

Returns PollerZmq

Definition at line 480 of file ActorZmq.cc.

References Salsa::ActorZmq::mpPoller.

Referenced by Salsa::NodeManagerZyre::addTaskSlot().

◆ print()

void Salsa::Node::print ( ) const
virtualinherited

Prints node info

Definition at line 91 of file Node.cc.

References Salsa::Node::mChildNodes, Salsa::Node::mpNodeInfo, Salsa::Node::mpParent, and Salsa::Node::mPublishers.

◆ publish()

void Salsa::Node::publish ( )
virtualinherited

Publish network status

Definition at line 150 of file Node.cc.

References Salsa::Node::json(), Salsa::Node::mPublishers, Salsa::Node::name(), Salsa::Node::parent(), and Salsa::Node::publishers().

◆ removeByUUID()

void Salsa::Node::removeByUUID ( std::string  uuid)
inherited

Remove node by uuid.

Removes node by uuid

Definition at line 130 of file Node.cc.

References Salsa::Node::mChildNodes.

◆ SalsaActorFn()

void Salsa::ActorZmq::SalsaActorFn ( zsock_t *  pPipe,
void *  pArgv 
)
staticinherited

◆ signalHandler()

void Salsa::Actor::signalHandler ( int  signalNumber)
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().

◆ sockets()

std::vector< std::shared_ptr< SocketZyre > > Salsa::NodeZyre::sockets ( ) const

Returns list of sockets

Definition at line 250 of file NodeZyre.cc.

References mSockets.

Referenced by exec(), and handleExternalZmq().

◆ wait()

void * Salsa::ActorZmq::wait ( )
virtualinherited

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