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

Base Feeder class. More...

#include <Feeder.hh>

Inheritance diagram for Salsa::Feeder:
Salsa::Distributor Salsa::Object

Public Member Functions

 Feeder (std::string uuid, std::shared_ptr< Socket > pPipe, NodeManager *pNM)
 
virtual ~Feeder ()
 
virtual void onEnter (Message *pInMsg, std::vector< std::string > &out, std::string type)
 TODO Three horsemen of apocalypse.
 
virtual void onExit (Message *pInMsg, std::vector< std::string > &out)
 
virtual void onWhisper (Message *pInMsg, std::vector< std::string > &out)
 
void subscribe (std::string uuid)
 
void removeWorkerTask (TaskInfo *pTI)
 
void removeWorkerTask (TaskInfo *pTI, std::string uuid)
 
void terminateJob (std::string uuid)
 
std::string uuid () const
 Returns distributor's UUID.
 
std::shared_ptr< Socketpipe () const
 TODO Returns distributor's pipe?
 
void print () const
 TODO Prints distributor's state.
 
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::map< std::string, std::vector< TaskInfo * > > mWorkerTasks {}
 Worker tasks.
 
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.
 

Static Private Attributes

static std::shared_ptr< spdlog::logger > mspConsoleLogger = spdlog::stdout_color_mt("salsa")
 Pointer to spd logger.
 

Detailed Description

Constructor & Destructor Documentation

◆ Feeder()

Salsa::Feeder::Feeder ( std::string uuid,
std::shared_ptr< Socket > pPipe,
NodeManager * pNM )

◆ ~Feeder()

Salsa::Feeder::~Feeder ( )
virtual

Destructor

Definition at line 16 of file Feeder.cc.

Member Function Documentation

◆ addClient()

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

Adds client

Definition at line 18 of file Distributor.cc.

References mClients, and uuid().

◆ addOther()

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

Adds other

Definition at line 34 of file Distributor.cc.

References mOthers, and uuid().

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

◆ jsonValueNodeInfo()

Json::Value Salsa::Distributor::jsonValueNodeInfo ( ) const
inlineinherited

Returns json value.

Definition at line 50 of file Distributor.hh.

References mJsonValue.

◆ nodeInfo()

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

Returns node info

Definition at line 92 of file Distributor.cc.

References mpNodeInfo.

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

◆ onEnter()

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

TODO Three horsemen of apocalypse.

onEnter

Reimplemented from Salsa::Distributor.

Definition at line 23 of file Feeder.cc.

References Salsa::Distributor::mpNodeManager.

◆ onExit()

◆ onWhisper()

◆ pipe()

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 mpPipe.

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

◆ print()

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

TODO Prints distributor's state.

Prints info

Definition at line 50 of file Distributor.cc.

References mClients, mOthers, and mpPipe.

◆ removeClient()

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

Remove client

Definition at line 26 of file Distributor.cc.

References mClients, and uuid().

◆ removeOther()

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

Remove other

Definition at line 42 of file Distributor.cc.

References mOthers, and uuid().

◆ removeWorkerTask() [1/2]

void Salsa::Feeder::removeWorkerTask ( TaskInfo * pTI)

Remove task from mWorkerTasks (all workers)

Definition at line 215 of file Feeder.cc.

References mWorkerTasks, and removeWorkerTask().

Referenced by onWhisper(), removeWorkerTask(), and terminateJob().

◆ removeWorkerTask() [2/2]

void Salsa::Feeder::removeWorkerTask ( TaskInfo * pTI,
std::string uuid )

Remove task from mWorkerTasks (wotker with uuid)

Definition at line 226 of file Feeder.cc.

References mWorkerTasks, and Salsa::Distributor::uuid().

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

◆ subscribe()

void Salsa::Feeder::subscribe ( std::string uuid)

◆ terminateJob()

void Salsa::Feeder::terminateJob ( std::string uuid)

◆ upadateJsonValueNodeInfo()

void Salsa::Distributor::upadateJsonValueNodeInfo ( )
virtualinherited

Updates json value with node info

Definition at line 100 of file Distributor.cc.

References mJsonValue, and mpNodeInfo.

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

◆ uuid()

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

Member Data Documentation

◆ mClients

std::map<std::string, std::string> Salsa::Distributor::mClients {}
protectedinherited

◆ mJsonValue

Json::Value Salsa::Distributor::mJsonValue
protectedinherited

Node Info as json value.

Definition at line 60 of file Distributor.hh.

Referenced by jsonValueNodeInfo(), and upadateJsonValueNodeInfo().

◆ mOthers

std::map<std::string, std::string> Salsa::Distributor::mOthers {}
protectedinherited

List of others.

Definition at line 57 of file Distributor.hh.

Referenced by addOther(), print(), and removeOther().

◆ mpNodeInfo

NodeInfo* Salsa::Distributor::mpNodeInfo {new NodeInfo()}
protectedinherited

◆ mpNodeManager

◆ mpPipe

std::shared_ptr<Socket> Salsa::Distributor::mpPipe = nullptr
protectedinherited

Pipe for messages (net connector)

Definition at line 55 of file Distributor.hh.

Referenced by Distributor(), pipe(), and print().

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

◆ mTaskInfoCache

TaskInfo Salsa::Distributor::mTaskInfoCache {}
mutableprotectedinherited

Task Info cache.

Definition at line 62 of file Distributor.hh.

◆ mUUID

std::string Salsa::Distributor::mUUID {}
protectedinherited

◆ mWorkerTasks

std::map<std::string, std::vector<TaskInfo *> > Salsa::Feeder::mWorkerTasks {}
protected

Worker tasks.

Definition at line 33 of file Feeder.hh.

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


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