salsa  0.4.0
 All Classes Functions Variables Typedefs Enumerations Pages
Salsa::Worker Class Reference

Worker class. More...

#include <Worker.hh>

Inheritance diagram for Salsa::Worker:
Salsa::Distributor Salsa::Object

Public Member Functions

 Worker (std::string uuid, std::shared_ptr< Socket > pPipe, NodeManager *pNM)
 
virtual ~Worker ()
 
uint32_t numCores () const
 
virtual void onEnter (Message *pInMsg, std::vector< std::string > &out, std::string type)
 TODO Three horsemen of apocalypse. More...
 
virtual void onExit (Message *pInMsg, std::vector< std::string > &out)
 
virtual void onWhisper (Message *pInMsg, std::vector< std::string > &out)
 
std::string uuid () const
 Returns distributor's UUID. More...
 
std::shared_ptr< Socketpipe () const
 TODO Returns distributor's pipe? More...
 
void print () const
 TODO Prints distributor's state. More...
 
void addClient (std::string uuid, std::string type)
 
void removeClient (std::string uuid)
 
void addOther (std::string uuid, std::string type)
 
void removeOther (std::string uuid)
 
NodeInfo * nodeInfo () const
 
Json::Value jsonValueNodeInfo () const
 Returns json value.
 
virtual void upadateJsonValueNodeInfo ()
 

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::string mUUID {}
 Self UUID.
 
std::shared_ptr< SocketmpPipe = nullptr
 Pipe for messages (net connector)
 
std::map< std::string,
std::string > 
mClients {}
 List of clients.
 
std::map< std::string,
std::string > 
mOthers {}
 List of others.
 
NodeManagermpNodeManager = nullptr
 Node Manager.
 
NodeInfo * mpNodeInfo {new NodeInfo()}
 Node Info.
 
Json::Value mJsonValue
 Node Info as json value.
 
TaskInfo mTaskInfoCache {}
 Task Info cache.
 

Private Attributes

uint32_t mNumCores = -1
 Number of cores.
 

Detailed Description

Constructor & Destructor Documentation

Salsa::Worker::Worker ( std::string  uuid,
std::shared_ptr< Socket pPipe,
NodeManager pNM 
)
Salsa::Worker::~Worker ( )
virtual

Destructor

Definition at line 58 of file Worker.cc.

Member Function Documentation

void Salsa::Distributor::addClient ( std::string  uuid,
std::string  type 
)
inherited

Adds client

Definition at line 18 of file Distributor.cc.

References Salsa::Distributor::mClients.

void Salsa::Distributor::addOther ( std::string  uuid,
std::string  type 
)
inherited

Adds other

Definition at line 34 of file Distributor.cc.

References Salsa::Distributor::mOthers.

NodeInfo * Salsa::Distributor::nodeInfo ( ) const
inherited

Returns node info

Definition at line 92 of file Distributor.cc.

References Salsa::Distributor::mpNodeInfo.

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

uint32_t Salsa::Worker::numCores ( ) const

Returns number of cores

Definition at line 65 of file Worker.cc.

References mNumCores.

void Salsa::Worker::onEnter ( Message pInMsg,
std::vector< std::string > &  out,
std::string  type 
)
virtual

TODO Three horsemen of apocalypse.

onEnter

onEnter

Reimplemented from Salsa::Distributor.

Definition at line 80 of file Worker.cc.

References Salsa::Distributor::mpNodeInfo.

void Salsa::Worker::onExit ( Message pInMsg,
std::vector< std::string > &  out 
)
virtual

onExit

Reimplemented from Salsa::Distributor.

Definition at line 93 of file Worker.cc.

std::shared_ptr< Socket > Salsa::Distributor::pipe ( ) const
inherited

TODO Returns distributor's pipe?

Returns pipe socket

Definition at line 77 of file Distributor.cc.

References Salsa::Distributor::mpPipe.

Referenced by Salsa::Feeder::subscribe(), and Salsa::Feeder::terminateJob().

void Salsa::Distributor::print ( ) const
inherited

TODO Prints distributor's state.

Prints info

Definition at line 50 of file Distributor.cc.

References Salsa::Distributor::mClients, Salsa::Distributor::mOthers, and Salsa::Distributor::mpPipe.

void Salsa::Distributor::removeClient ( std::string  uuid)
inherited

Remove client

Definition at line 26 of file Distributor.cc.

References Salsa::Distributor::mClients.

void Salsa::Distributor::removeOther ( std::string  uuid)
inherited

Remove other

Definition at line 42 of file Distributor.cc.

References Salsa::Distributor::mOthers.

void Salsa::Distributor::upadateJsonValueNodeInfo ( )
virtualinherited

Updates json value with node info

Definition at line 100 of file Distributor.cc.

References Salsa::Distributor::mJsonValue, and Salsa::Distributor::mpNodeInfo.

Referenced by Salsa::Feeder::onExit(), and Salsa::Feeder::onWhisper().

std::string Salsa::Distributor::uuid ( ) const
inherited

Returns distributor's UUID.

Returns uuid

Definition at line 84 of file Distributor.cc.

References Salsa::Distributor::mUUID.

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


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