salsa
0.4.0
|
#include <Feeder.hh>
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. More... | |
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. More... | |
std::shared_ptr< Socket > | pipe () 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 |
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< Socket > | mpPipe = 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. | |
NodeManager * | mpNodeManager = nullptr |
Node Manager. | |
NodeInfo * | mpNodeInfo {new NodeInfo()} |
Node Info. | |
TaskInfo | mTaskInfoCache {} |
Task Info cache. | |
Salsa::Feeder::Feeder | ( | std::string | uuid, |
std::shared_ptr< Socket > | pPipe, | ||
NodeManager * | pNM | ||
) |
Constructor
Definition at line 8 of file Feeder.cc.
References Salsa::Distributor::mpNodeInfo, and Salsa::Distributor::mUUID.
|
inherited |
Adds client
Definition at line 18 of file Distributor.cc.
References Salsa::Distributor::mClients, and Salsa::Distributor::uuid().
|
inherited |
Adds other
Definition at line 34 of file Distributor.cc.
References Salsa::Distributor::mOthers, and Salsa::Distributor::uuid().
|
inherited |
Returns node info
Definition at line 92 of file Distributor.cc.
References Salsa::Distributor::mpNodeInfo.
Referenced by onWhisper().
|
virtual |
TODO Three horsemen of apocalypse.
onEnter
onEnter
Reimplemented from Salsa::Distributor.
Definition at line 23 of file Feeder.cc.
References Salsa::NodeManager::hasJobs(), and Salsa::Distributor::mpNodeManager.
|
virtual |
onExit
Reimplemented from Salsa::Distributor.
Definition at line 34 of file Feeder.cc.
References Salsa::NodeManager::consumer(), Salsa::NodeManager::haveMoreTasks(), Salsa::NodeManager::job(), Salsa::Distributor::mClients, Salsa::Job::moveTask(), Salsa::Distributor::mpNodeInfo, Salsa::Distributor::mpNodeManager, mWorkerTasks, Salsa::NodeManager::print(), Salsa::NodeManager::sendWhisper(), subscribe(), and Salsa::Message::uuid().
|
virtual |
onWhisper
Reimplemented from Salsa::Distributor.
Definition at line 99 of file Feeder.cc.
References Salsa::NodeManager::consumer(), Salsa::Job::consumer(), Salsa::Message::content(), Salsa::Job::feeder(), Salsa::NodeManager::getNextTask(), Salsa::Job::isTaskInQueue(), Salsa::NodeManager::job(), Salsa::Job::moveTask(), Salsa::Distributor::mpNodeInfo, Salsa::Distributor::mpNodeManager, mWorkerTasks, Salsa::Distributor::nodeInfo(), Salsa::NodeManager::print(), removeWorkerTask(), Salsa::NodeManager::resultTask(), Salsa::NodeManager::sendWhisper(), and Salsa::Message::uuid().
|
inherited |
TODO Returns distributor's pipe?
Returns pipe socket
Definition at line 77 of file Distributor.cc.
References Salsa::Distributor::mpPipe.
Referenced by subscribe(), and terminateJob().
|
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.
|
inherited |
Remove client
Definition at line 26 of file Distributor.cc.
References Salsa::Distributor::mClients, and Salsa::Distributor::uuid().
|
inherited |
Remove other
Definition at line 42 of file Distributor.cc.
References Salsa::Distributor::mOthers, and Salsa::Distributor::uuid().
void Salsa::Feeder::removeWorkerTask | ( | TaskInfo * | pTI | ) |
Remove task from mWorkerTasks (all workers)
Definition at line 212 of file Feeder.cc.
References mWorkerTasks.
Referenced by onWhisper(), and terminateJob().
void Salsa::Feeder::removeWorkerTask | ( | TaskInfo * | pTI, |
std::string | uuid | ||
) |
Remove task from mWorkerTasks (wotker with uuid)
Definition at line 223 of file Feeder.cc.
References mWorkerTasks, and Salsa::Distributor::uuid().
void Salsa::Feeder::subscribe | ( | std::string | uuid | ) |
subscribe
Definition at line 197 of file Feeder.cc.
References Salsa::Distributor::mClients, Salsa::Distributor::mpNodeManager, Salsa::Distributor::pipe(), Salsa::NodeManager::sendWhisper(), and Salsa::Distributor::uuid().
Referenced by onExit().
void Salsa::Feeder::terminateJob | ( | std::string | uuid | ) |
Terminate job
Definition at line 241 of file Feeder.cc.
References Salsa::NodeManager::job(), Salsa::Distributor::mClients, Salsa::Distributor::mpNodeManager, Salsa::Distributor::pipe(), removeWorkerTask(), Salsa::NodeManager::sendWhisper(), Salsa::Job::tasks(), and Salsa::Distributor::uuid().
|
inherited |
Returns distributor's UUID.
Returns uuid
Definition at line 84 of file Distributor.cc.
References Salsa::Distributor::mUUID.
Referenced by Salsa::Distributor::addClient(), Salsa::Distributor::addOther(), Salsa::Distributor::removeClient(), Salsa::Distributor::removeOther(), removeWorkerTask(), subscribe(), and terminateJob().