salsa 0.7.1
Loading...
Searching...
No Matches
Salsa::ActorZmq Class Reference

ZeroMQ implementation of salsa actor class. More...

#include <ActorZmq.hh>

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

Public Member Functions

 ActorZmq ()
 
virtual ~ActorZmq ()
 
virtual void pipe (void *pipe)
 Setter for pipe.
 
virtual int init ()
 First function.
 
virtual int exec ()
 Main function.
 
virtual int finish ()
 Last function.
 
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

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)
 

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

ZeroMQ implementation of salsa actor class.

Author
Matej Fedor matej.nosp@m..fed.nosp@m.or.mf.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Martin Vala mvala.nosp@m.@cer.nosp@m.n.ch
Branislav Beke bbeke.nosp@m.@bad.nosp@m.haven.nosp@m..dev

Definition at line 19 of file ActorZmq.hh.

Constructor & Destructor Documentation

◆ ActorZmq()

Salsa::ActorZmq::ActorZmq ( )

Constructor

Definition at line 4 of file ActorZmq.cc.

References Salsa::Actor::Actor(), and mpPoller.

Referenced by Salsa::NodeZyre::NodeZyre(), and SalsaActorFn().

◆ ~ActorZmq()

Salsa::ActorZmq::~ActorZmq ( )
virtual

Destructor

Definition at line 12 of file ActorZmq.cc.

References mpPoller.

Member Function Documentation

◆ actorProcwaitSupport_()

void Salsa::ActorZmq::actorProcwaitSupport_ ( zsock_t * pipe,
void * argv )
staticprivate

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

◆ exec()

int Salsa::ActorZmq::exec ( )
virtual

Main function.

Exec

Implements Salsa::Actor.

Reimplemented in Salsa::NodeZyre.

Definition at line 393 of file ActorZmq.cc.

References Salsa::Actor::interrupted(), mTerminated, and wait().

Referenced by SalsaActorFn().

◆ finish()

int Salsa::ActorZmq::finish ( )
virtual

Last function.

Finish

Implements Salsa::Actor.

Reimplemented in Salsa::NodeZyre.

Definition at line 415 of file ActorZmq.cc.

Referenced by SalsaActorFn().

◆ getConsoleOutput()

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

Get console output.

Definition at line 21 of file Object.hh.

References mspConsoleLogger.

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

◆ init()

int Salsa::ActorZmq::init ( )
virtual

First function.

Init

Implements Salsa::Actor.

Reimplemented in Salsa::NodeZyre.

Definition at line 378 of file ActorZmq.cc.

References Salsa::Actor::signalHandler().

Referenced by Salsa::NodeZyre::init(), and SalsaActorFn().

◆ 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 msInterrupted.

Referenced by Salsa::ActorZmq::exec(), Salsa::NodeZyre::exec(), Salsa::ActorZmq::SalsaActorFn(), and 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 msInterrupted.

◆ pipe()

void Salsa::ActorZmq::pipe ( void * )
virtual

Setter for pipe.

Setting pipe socket

Implements Salsa::Actor.

Definition at line 359 of file ActorZmq.cc.

References mpPipe, and mpPoller.

Referenced by SalsaActorFn().

◆ poller()

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

Returns zpoller

Definition at line 473 of file ActorZmq.cc.

References mpPoller.

◆ pollerZmq()

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

Returns PollerZmq

Definition at line 480 of file ActorZmq.cc.

References mpPoller.

◆ SalsaActorFn()

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

Actor function engine

Definition at line 22 of file ActorZmq.cc.

References ActorZmq(), exec(), finish(), init(), Salsa::Actor::interrupted(), pipe(), and terminated().

◆ SalsaActorForkFn()

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

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

◆ 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 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 interrupted(), and msInterrupted.

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

◆ terminated()

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

Flag if actor should be terminated.

Definition at line 40 of file ActorZmq.hh.

References mTerminated.

Referenced by SalsaActorFn().

◆ timeout() [1/2]

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

Returns timeout.

Definition at line 32 of file ActorZmq.hh.

References mTimeout.

◆ timeout() [2/2]

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

Sets timeout.

Definition at line 30 of file ActorZmq.hh.

References mTimeout.

◆ wait()

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

Waiting for event

Definition at line 426 of file ActorZmq.cc.

References mpPipe, mpPoller, mTerminated, and mTimeout.

Referenced by exec(), and Salsa::NodeZyre::exec().

Member Data Documentation

◆ mpPipe

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

Zmq pipe socket.

Definition at line 48 of file ActorZmq.hh.

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

◆ mpPoller

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

Internal poller.

Definition at line 49 of file ActorZmq.hh.

Referenced by ActorZmq(), Salsa::NodeZyre::init(), pipe(), poller(), pollerZmq(), wait(), and ~ActorZmq().

◆ 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 interrupted(), interrupted(), and signalHandler().

◆ 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 getConsoleOutput(), and setConsoleLevel().

◆ mTerminated

bool Salsa::ActorZmq::mTerminated = false
protected

Flag if actor should be terminated.

Definition at line 50 of file ActorZmq.hh.

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

◆ mTimeout

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

Poller timeout.

Definition at line 51 of file ActorZmq.hh.

Referenced by timeout(), timeout(), and wait().


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