salsa  0.3.0
 All Classes Functions Variables Enumerations Pages
Salsa::NodeManagerZyre Class Reference

NodeManagerZyre class. More...

#include <NodeManagerZyre.hh>

Inheritance diagram for Salsa::NodeManagerZyre:
Salsa::NodeManager Salsa::Object

Public Member Functions

 NodeManagerZyre (NodeZyre *pNodeZyre)
 
virtual ~NodeManagerZyre ()
 
virtual SocketonEnter (std::string self, std::string fromType, Message *pMsg, std::vector< std::string > &out)
 
virtual SocketonExit (std::string self, Message *pMsg, std::vector< std::string > &out)
 
virtual SocketonWhisper (std::string self, Message *pMsg, std::vector< std::string > &out)
 
virtual bool handleTaskPool (void *pPool)
 
virtual void addTaskSlot ()
 
virtual void runTask (TaskState *pTaskState, std::string wk, std::string upstream)
 Run task interface. More...
 
virtual bool sendWhisper (Socket *pSocket, std::string to, std::vector< std::string > &vect)
 
void print (std::string opt="") const
 
void addConsumer (std::string uuid, std::shared_ptr< Socket > s)
 
void addFeeder (std::string uuid, std::shared_ptr< Socket > s)
 
void addWorker (std::string uuid, std::shared_ptr< Socket > s)
 
void addTask (TaskInfo *taskInfo, std::string cuuid, std::string fuuid, Salsa::Job::QueueType t=Salsa::Job::pending)
 
std::shared_ptr< Feederfeeder (std::string uuid) const
 
std::shared_ptr< Consumerconsumer (std::string uuid) const
 
std::shared_ptr< Workerworker (std::string uuid) const
 
Jobjob (std::string uuid)
 
TaskPooltaskPool ()
 Get NM's task pool. More...
 
bool hasJobs () const
 
int32_t nSlots (double mult=1.0) const
 
void jobs (std::string clientUUID, std::vector< std::string > &jobs) const
 
TaskInfo * getNextTask ()
 
void resultTask (TaskInfo *task)
 
void noMoreTasks (std::string jobUUID)
 
bool haveMoreTasks ()
 
bool haveMoreTasks (std::string jobUUID)
 
virtual void terminateJob (std::string uuid)
 
virtual void terminateJobAll ()
 
virtual void publisher (Publisher *p)
 
virtual Publisherpublisher () const
 
virtual void publish (std::string id) const
 

Static Public Member Functions

static std::shared_ptr
< spdlog::logger > 
getConsoleOutput ()
 Get console output.
 
static void setConsoleLevel (spdlog::level::level_enum level)
 Sets console log level.
 

Protected Attributes

std::map< std::string, Job * > mJobs {}
 List of jobs.
 
std::vector< std::string > mActiveJobs {}
 List of active jobs.
 
std::map< std::string,
std::shared_ptr< Worker > > 
mWorkers {}
 List of Workers.
 
std::map< std::string,
std::shared_ptr< Consumer > > 
mConsumers {}
 List of Consumers.
 
std::map< std::string,
std::shared_ptr< Feeder > > 
mFeeders {}
 List of Feeders.
 
TaskPoolmpTaskPool = nullptr
 Task pool.
 
PublishermpPublisher = nullptr
 Publisher.
 

Private Attributes

NodeZyrempNodeZyre = nullptr
 Current zyre node.
 

Detailed Description

Constructor & Destructor Documentation

Salsa::NodeManagerZyre::NodeManagerZyre ( NodeZyre pNodeZyre)

Constructor

Definition at line 8 of file NodeManagerZyre.cc.

References Salsa::NodeManager::mpPublisher.

Salsa::NodeManagerZyre::~NodeManagerZyre ( )
virtual

Destructor

Definition at line 20 of file NodeManagerZyre.cc.

Member Function Documentation

void Salsa::NodeManager::addConsumer ( std::string  uuid,
std::shared_ptr< Socket s 
)
inherited

Add consumer

Definition at line 53 of file NodeManager.cc.

References Salsa::NodeManager::mConsumers.

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

void Salsa::NodeManager::addFeeder ( std::string  uuid,
std::shared_ptr< Socket s 
)
inherited

Add feeder

Definition at line 60 of file NodeManager.cc.

References Salsa::NodeManager::mFeeders.

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

void Salsa::NodeManager::addTask ( TaskInfo *  taskInfo,
std::string  cuuid,
std::string  fuuid,
Salsa::Job::QueueType  t = Salsa::Job::pending 
)
inherited
void Salsa::NodeManager::addWorker ( std::string  uuid,
std::shared_ptr< Socket s 
)
inherited

Add worker

Definition at line 67 of file NodeManager.cc.

References Salsa::NodeManager::mWorkers.

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

std::shared_ptr< Consumer > Salsa::NodeManager::consumer ( std::string  uuid) const
inherited
std::shared_ptr< Feeder > Salsa::NodeManager::feeder ( std::string  uuid) const
inherited
TaskInfo * Salsa::NodeManager::getNextTask ( )
inherited

Return Next task from job

Definition at line 252 of file NodeManager.cc.

References Salsa::NodeManager::mActiveJobs, and Salsa::NodeManager::mJobs.

Referenced by Salsa::Feeder::onWhisper().

bool Salsa::NodeManagerZyre::handleTaskPool ( void *  pPool)
virtual

Handle task pool

Reimplemented from Salsa::NodeManager.

Definition at line 107 of file NodeManagerZyre.cc.

References Salsa::TaskPool::handlePipe(), and Salsa::NodeManager::mpTaskPool.

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

bool Salsa::NodeManager::hasJobs ( ) const
inherited

Returns if jobs are active

Definition at line 457 of file NodeManager.cc.

References Salsa::NodeManager::mActiveJobs.

Referenced by Salsa::Feeder::onEnter().

bool Salsa::NodeManager::haveMoreTasks ( )
inherited

Sets no more tasks to any job

Definition at line 501 of file NodeManager.cc.

References Salsa::Job::haveMoreTasks(), Salsa::NodeManager::job(), Salsa::NodeManager::mActiveJobs, and Salsa::NodeManager::mJobs.

Referenced by Salsa::Feeder::onExit().

bool Salsa::NodeManager::haveMoreTasks ( std::string  jobUUID)
inherited

Sets no more tasks to job with jobuuid

Definition at line 529 of file NodeManager.cc.

References Salsa::NodeManager::mJobs.

void Salsa::NodeManager::jobs ( std::string  clientUUID,
std::vector< std::string > &  jobs 
) const
inherited

Returns list of jobs

Definition at line 465 of file NodeManager.cc.

References Salsa::NodeManager::mJobs.

Referenced by Salsa::Consumer::onExit().

void Salsa::NodeManager::noMoreTasks ( std::string  jobUUID)
inherited

Sets no more tasks to job with jobuuid

Definition at line 490 of file NodeManager.cc.

References Salsa::NodeManager::mJobs.

Referenced by Salsa::Consumer::onWhisper().

int32_t Salsa::NodeManager::nSlots ( double  mult = 1.0) const
inherited

Returns numer of slots

Definition at line 477 of file NodeManager.cc.

References Salsa::NodeManager::feeder(), and Salsa::NodeManager::mFeeders.

Referenced by Salsa::Consumer::onWhisper(), and Salsa::NodeManager::resultTask().

Socket * Salsa::NodeManagerZyre::onEnter ( std::string  self,
std::string  fromType,
Message pMsg,
std::vector< std::string > &  out 
)
virtual

On ENTER event

Reimplemented from Salsa::NodeManager.

Definition at line 27 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onEnter(), sendWhisper(), and Salsa::Message::uuid().

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

Socket * Salsa::NodeManagerZyre::onExit ( std::string  self,
Message pMsg,
std::vector< std::string > &  out 
)
virtual

On EXIT event

Reimplemented from Salsa::NodeManager.

Definition at line 43 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onExit(), sendWhisper(), and Salsa::Message::uuid().

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

Socket * Salsa::NodeManagerZyre::onWhisper ( std::string  self,
Message pMsg,
std::vector< std::string > &  out 
)
virtual

On WHISPER event

Reimplemented from Salsa::NodeManager.

Definition at line 57 of file NodeManagerZyre.cc.

References Salsa::NodeManager::onWhisper(), sendWhisper(), and Salsa::Message::uuid().

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

void Salsa::NodeManager::publish ( std::string  id) const
virtualinherited
void Salsa::NodeManager::publisher ( Publisher p)
virtualinherited

Sets publisher

Definition at line 541 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

Publisher * Salsa::NodeManager::publisher ( ) const
virtualinherited

Returns publisher

Definition at line 549 of file NodeManager.cc.

References Salsa::NodeManager::mpPublisher.

void Salsa::NodeManagerZyre::runTask ( TaskState ts,
std::string  wk,
std::string  upstream 
)
virtual

Run task interface.

Run task

Implements Salsa::NodeManager.

Definition at line 96 of file NodeManagerZyre.cc.

References Salsa::TaskState::executor(), Salsa::TaskExecutor::run(), and Salsa::TaskState::task().

bool Salsa::NodeManagerZyre::sendWhisper ( Socket pSocket,
std::string  to,
std::vector< std::string > &  vect 
)
virtual

Sends message via zyre whisper

Reimplemented from Salsa::NodeManager.

Definition at line 118 of file NodeManagerZyre.cc.

References Salsa::SocketZyre::zyre().

Referenced by onEnter(), onExit(), and onWhisper().

TaskPool * Salsa::NodeManager::taskPool ( )
inherited

Get NM's task pool.

Returns task pool

Definition at line 449 of file NodeManager.cc.

References Salsa::NodeManager::mpTaskPool.

Referenced by Salsa::Worker::onWhisper().

void Salsa::NodeManager::terminateJobAll ( )
virtualinherited

Terminate all jobs

Definition at line 364 of file NodeManager.cc.

References Salsa::NodeManager::mJobs, and Salsa::NodeManager::terminateJob().

Referenced by Salsa::NodeZyre::handleZmq().

std::shared_ptr< Worker > Salsa::NodeManager::worker ( std::string  uuid) const
inherited

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