salsa 0.7.1
Loading...
Searching...
No Matches
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)
 
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< 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.
 
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
 
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.
 
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.
 

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.
 
NodeManagerZyrempNodeManager = 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.
 

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 21 of file NodeZyre.cc.

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

Member Function Documentation

◆ actorProcwaitSupport_()

void Salsa::ActorZmq::actorProcwaitSupport_ ( zsock_t * pipe,
void * argv )
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 Salsa::ActorZmq::SalsaActorForkFn().

◆ add() [1/2]

void Salsa::Node::add ( std::shared_ptr< Node > node)
inlineinherited

Adds node to the list of nodes.

Definition at line 53 of file Node.hh.

References Salsa::Node::mChildNodes.

Referenced by addSocket().

◆ add() [2/2]

void Salsa::Node::add ( std::shared_ptr< Publisher > pPublisher)
inlineinherited

Adds publisher to the node.

Definition at line 65 of file Node.hh.

References Salsa::Node::mPublishers.

◆ addSocket() [1/2]

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.

◆ addSocket() [2/2]

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

Returns list of zmq sockets

Definition at line 278 of file NodeZyre.cc.

References mZmqSockets.

◆ clusterAlias() [1/2]

std::string Salsa::NodeZyre::clusterAlias ( )
inline

Returns Cluster alias.

Definition at line 47 of file NodeZyre.hh.

References mClusterAlias.

◆ clusterAlias() [2/2]

void Salsa::NodeZyre::clusterAlias ( std::string n)
inline

Sets Cluster alias.

Definition at line 45 of file NodeZyre.hh.

References mClusterAlias.

◆ 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 103 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 242 of file NodeZyre.cc.

◆ getConsoleOutput()

static std::shared_ptr< spdlog::logger > Salsa::Object::getConsoleOutput ( )
inlinestaticinherited

Get console output.

Definition at line 21 of file Object.hh.

References Salsa::Object::mspConsoleLogger.

Referenced by Salsa::ConfigZyre::apply().

◆ handleExternalZmq()

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

◆ hostname() [1/2]

std::string Salsa::Node::hostname ( ) const
inlineinherited

Returns node hostname.

Definition at line 37 of file Node.hh.

References Salsa::Node::mpNodeInfo.

Referenced by init().

◆ hostname() [2/2]

void Salsa::Node::hostname ( std::string h)
inlineinherited

Sets node hostname.

Definition at line 48 of file Node.hh.

References Salsa::Node::mpNodeInfo.

◆ init()

◆ interrupted() [1/2]

static std::sig_atomic_t Salsa::Actor::interrupted ( )
inlinestaticinherited

Returns if salsa is interrupted.

Definition at line 35 of file Actor.hh.

References Salsa::Actor::msInterrupted.

Referenced by Salsa::ActorZmq::exec(), exec(), Salsa::ActorZmq::SalsaActorFn(), and Salsa::Actor::signalHandler().

◆ interrupted() [2/2]

static void Salsa::Actor::interrupted ( std::sig_atomic_t sig)
inlinestaticinherited

Setter salsa interruption.

Definition at line 38 of file Actor.hh.

References Salsa::Actor::msInterrupted.

◆ jobInfoBrokerUrl() [1/2]

std::string Salsa::NodeZyre::jobInfoBrokerUrl ( )
inline

Returns JobInfo broker url.

Definition at line 55 of file NodeZyre.hh.

References mJobInfoBrokerUrl.

◆ jobInfoBrokerUrl() [2/2]

void Salsa::NodeZyre::jobInfoBrokerUrl ( std::string url)
inline

Sets JobInfo broker url.

Definition at line 53 of file NodeZyre.hh.

References mJobInfoBrokerUrl.

◆ jobInfoClientUrl() [1/2]

std::string Salsa::NodeZyre::jobInfoClientUrl ( )
inline

Returns JobInfo client url.

Definition at line 63 of file NodeZyre.hh.

References mJobInfoClientUrl.

◆ jobInfoClientUrl() [2/2]

void Salsa::NodeZyre::jobInfoClientUrl ( std::string url)
inline

Sets JobInfo client url.

Definition at line 61 of file NodeZyre.hh.

References mJobInfoClientUrl.

◆ jobInfoGroupName() [1/2]

std::string Salsa::NodeZyre::jobInfoGroupName ( )
inline

Returns JobInfo Group name.

Definition at line 51 of file NodeZyre.hh.

References mJobInfoGroupName.

◆ jobInfoGroupName() [2/2]

void Salsa::NodeZyre::jobInfoGroupName ( std::string n)
inline

Sets JobInfo Group name.

Definition at line 49 of file NodeZyre.hh.

References mJobInfoGroupName.

◆ json()

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

Returns Node in json format

Definition at line 34 of file Node.cc.

References Salsa::Node::mChildNodes.

◆ name() [1/2]

std::string Salsa::Node::name ( ) const
inlineinherited

Returns node name.

Definition at line 33 of file Node.hh.

References Salsa::Node::mpNodeInfo.

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

◆ name() [2/2]

void Salsa::Node::name ( std::string n)
inlineinherited

Sets node name.

Definition at line 44 of file Node.hh.

References Salsa::Node::mpNodeInfo.

◆ nodeInfo()

NodeInfo * Salsa::Node::nodeInfo ( ) const
inlineinherited

Returns Node Info.

Definition at line 69 of file Node.hh.

References Salsa::Node::mpNodeInfo.

◆ nodes()

std::vector< std::shared_ptr< Node > > Salsa::Node::nodes ( ) const
inlineinherited

Returns nodes.

Definition at line 41 of file Node.hh.

References Salsa::Node::mChildNodes.

◆ parent() [1/2]

std::weak_ptr< Node > Salsa::Node::parent ( ) const
inlineinherited

Returns parent node.

Definition at line 39 of file Node.hh.

References Salsa::Node::mpParent.

◆ parent() [2/2]

void Salsa::Node::parent ( std::weak_ptr< Node > node)
inlineinherited

Sets parent.

Definition at line 50 of file Node.hh.

References Salsa::Node::mpParent.

◆ 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 81 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 140 of file Node.cc.

◆ publishers()

std::vector< std::shared_ptr< Publisher > > Salsa::Node::publishers ( ) const
inlineinherited

Returns publishers.

Definition at line 67 of file Node.hh.

References Salsa::Node::mPublishers.

◆ removeByUUID()

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

Remove node by uuid.

Removes node by uuid

Definition at line 120 of file Node.cc.

References Salsa::Node::mChildNodes.

◆ SalsaActorFn()

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

◆ SalsaActorForkFn()

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

◆ setConsoleLevel()

static void Salsa::Object::setConsoleLevel ( spdlog::level::level_enum level)
inlinestaticinherited

Sets console log level.

Definition at line 29 of file Object.hh.

References Salsa::Object::mspConsoleLogger.

◆ 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().

◆ socketExternal()

zsock_t * Salsa::NodeZyre::socketExternal ( int i)
inline

Rerturns external socket.

Definition at line 36 of file NodeZyre.hh.

References mZmqSockets.

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

◆ sockets()

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().

◆ submitClientUrl() [1/2]

std::string Salsa::NodeZyre::submitClientUrl ( )
inline

Returns Submit client url.

Definition at line 59 of file NodeZyre.hh.

References mSubmitClientUrl.

◆ submitClientUrl() [2/2]

void Salsa::NodeZyre::submitClientUrl ( std::string url)
inline

Sets Submit client url.

Definition at line 57 of file NodeZyre.hh.

References mSubmitClientUrl.

◆ terminated()

bool Salsa::ActorZmq::terminated ( ) const
inlineinherited

Flag if actor should be terminated.

Definition at line 40 of file ActorZmq.hh.

References Salsa::ActorZmq::mTerminated.

Referenced by Salsa::ActorZmq::SalsaActorFn().

◆ timeout() [1/2]

int Salsa::ActorZmq::timeout ( ) const
inlineinherited

Returns timeout.

Definition at line 32 of file ActorZmq.hh.

References Salsa::ActorZmq::mTimeout.

◆ timeout() [2/2]

void Salsa::ActorZmq::timeout ( int t)
inlineinherited

Sets timeout.

Definition at line 30 of file ActorZmq.hh.

References Salsa::ActorZmq::mTimeout.

◆ type() [1/2]

std::string Salsa::NodeZyre::type ( )
inline

Returns type of current node.

Definition at line 43 of file NodeZyre.hh.

References mType.

Referenced by exec().

◆ type() [2/2]

void Salsa::NodeZyre::type ( std::string t)
inline

Sets type of current node.

Definition at line 41 of file NodeZyre.hh.

References mType.

◆ uuid() [1/2]

std::string Salsa::Node::uuid ( ) const
inlineinherited

Returns node UUID.

Definition at line 35 of file Node.hh.

References Salsa::Node::mpNodeInfo.

Referenced by Salsa::Node::Node(), and Salsa::Node::uuid().

◆ uuid() [2/2]

void Salsa::Node::uuid ( std::string uuid)
inlineinherited

Sets node uuid.

Definition at line 46 of file Node.hh.

References Salsa::Node::mpNodeInfo, and Salsa::Node::uuid().

◆ wait()

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

Member Data Documentation

◆ mChildNodes

std::vector<std::shared_ptr<Node> > Salsa::Node::mChildNodes = {}
protectedinherited

◆ mClusterAlias

std::string Salsa::NodeZyre::mClusterAlias {"local"}
private

Cluster alias.

Definition at line 70 of file NodeZyre.hh.

Referenced by clusterAlias(), clusterAlias(), and init().

◆ mJobCheckTimeout

int Salsa::NodeZyre::mJobCheckTimeout
private

Job check timeout.

Definition at line 75 of file NodeZyre.hh.

Referenced by exec(), and init().

◆ mJobInfoBrokerUrl

std::string Salsa::NodeZyre::mJobInfoBrokerUrl
private

JobInfo broker url (salsa-broker –in ...)

Definition at line 72 of file NodeZyre.hh.

Referenced by init(), jobInfoBrokerUrl(), and jobInfoBrokerUrl().

◆ mJobInfoClientUrl

std::string Salsa::NodeZyre::mJobInfoClientUrl
private

JobInfo url for client (salsa-broker –out ...)

Definition at line 73 of file NodeZyre.hh.

Referenced by handleExternalZmq(), jobInfoClientUrl(), and jobInfoClientUrl().

◆ mJobInfoGroupName

std::string Salsa::NodeZyre::mJobInfoGroupName
private

JobInfo Group name.

Definition at line 71 of file NodeZyre.hh.

Referenced by init(), jobInfoGroupName(), and jobInfoGroupName().

◆ mpNodeInfo

◆ mpNodeManager

NodeManagerZyre* Salsa::NodeZyre::mpNodeManager = nullptr
private

Job manager.

Definition at line 68 of file NodeZyre.hh.

Referenced by exec(), handleExternalZmq(), init(), and ~NodeZyre().

◆ mpParent

std::weak_ptr<Node> Salsa::Node::mpParent
protectedinherited

Parent node.

Definition at line 73 of file Node.hh.

Referenced by Salsa::Node::parent(), Salsa::Node::parent(), and Salsa::Node::print().

◆ mpPipe

zsock_t* Salsa::ActorZmq::mpPipe = nullptr
protectedinherited

Zmq pipe socket.

Definition at line 48 of file ActorZmq.hh.

Referenced by exec(), Salsa::ActorZmq::pipe(), and Salsa::ActorZmq::wait().

◆ mpPoller

PollerZmq* Salsa::ActorZmq::mpPoller = nullptr
protectedinherited

◆ mPublishers

std::vector<std::shared_ptr<Publisher> > Salsa::Node::mPublishers = {}
protectedinherited

List of publishers.

Definition at line 75 of file Node.hh.

Referenced by Salsa::Node::add(), Salsa::Node::print(), Salsa::Node::publishers(), and Salsa::Node::~Node().

◆ msInterrupted

std::sig_atomic_t Salsa::Actor::msInterrupted = 0
staticprivateinherited

flag if salsa is interrupted

Definition at line 44 of file Actor.hh.

Referenced by Salsa::Actor::interrupted(), Salsa::Actor::interrupted(), and Salsa::Actor::signalHandler().

◆ mSockets

std::vector<std::shared_ptr<SocketZyre> > Salsa::NodeZyre::mSockets {}
private

List of zyre sockets.

Definition at line 66 of file NodeZyre.hh.

Referenced by addSocket(), exec(), init(), sockets(), and ~NodeZyre().

◆ mspConsoleLogger

std::shared_ptr< spdlog::logger > Salsa::Object::mspConsoleLogger = spdlog::stdout_color_mt("salsa")
staticprivateinherited

Pointer to spd logger.

Definition at line 32 of file Object.hh.

Referenced by Salsa::Object::getConsoleOutput(), and Salsa::Object::setConsoleLevel().

◆ mSubmitClientUrl

std::string Salsa::NodeZyre::mSubmitClientUrl
private

Submit url for client.

Definition at line 74 of file NodeZyre.hh.

Referenced by init(), submitClientUrl(), and submitClientUrl().

◆ mTerminated

bool Salsa::ActorZmq::mTerminated = false
protectedinherited

Flag if actor should be terminated.

Definition at line 50 of file ActorZmq.hh.

Referenced by Salsa::ActorZmq::exec(), exec(), Salsa::ActorZmq::terminated(), and Salsa::ActorZmq::wait().

◆ mTimeout

int Salsa::ActorZmq::mTimeout = -1
protectedinherited

Poller timeout.

Definition at line 51 of file ActorZmq.hh.

Referenced by Salsa::ActorZmq::timeout(), Salsa::ActorZmq::timeout(), and Salsa::ActorZmq::wait().

◆ mType

std::string Salsa::NodeZyre::mType
private

Current node type.

Definition at line 69 of file NodeZyre.hh.

Referenced by init(), type(), and type().

◆ mZmqSockets

std::vector<zsock_t *> Salsa::NodeZyre::mZmqSockets {}
private

List of zmq sockets.

Definition at line 67 of file NodeZyre.hh.

Referenced by addSocket(), exec(), handleExternalZmq(), init(), socketExternal(), and ~NodeZyre().


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