hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DataReducerProxy.hpp
Go to the documentation of this file.
1 
17 #ifndef __HCE_DATAREDUCER_PROXY_INCLUDED__
18 #define __HCE_DATAREDUCER_PROXY_INCLUDED__
19 
20 #include <sstream>
21 #include <map>
22 #include <iterator>
23 #include <Poco/Checksum.h>
24 
25 #include "Handler.hpp"
26 
27 //Sphinx functional object dependencies
30 #include "SphinxSearcher.hpp"
31 #include "SphinxError.hpp"
32 //Reducer functional object dependencies
34 //Message cover object
35 #include "JsonMessageCover.hpp"
36 
37 namespace HCE {
38  namespace handlers {
39 
41  public:
46 
47  DataReducerProxy(std::string name, zmq::context_t& ctx, const std::string& clientIdentity, unsigned char nodeMode, int64_t startedAt, unsigned char logPriority, const std::string& iniFile);
49 
50  protected:
51  int initialize(void);
52  void deinitialize(void);
53  void* process(void);
54 
55  void handleInternalMessage(void);
56  std::string processAdminCommands(std::string& command, std::string& parameters);
57 
59  void reducerInit(void);
60 
62  void defaultReducerResponseItemCreate(std::string& messageId, std::string& messageBody);
64  static void defaultReducerResponseItemAccumulate(std::map<std::string, DefaultReducerResponseItem*>::iterator& DefaultReducerResponseItemIterator, std::string& messageBody);
66  std::string defaultReducerResponseItemReduce(std::map<std::string, DefaultReducerResponseItem*>::iterator& DefaultReducerResponseItemIterator);
68  void defaultReducerReducePlainText(std::string& messageId, std::string& messageBody);
70  void defaultReducerReduceJson(std::string& messageId, std::string& messageBody);
71 
73  void reduceJson(std::string& messageId, std::string& messageBody);
75  void reducerTasksCleanupByTtl(void);
76 
78  std::string getPropertyInformation(void);
79 
83 
85  void setStatRequests(unsigned int statRequests);
86  unsigned int getStatRequests(void);
87 
88  void setStatResponses(unsigned int statResponses);
89  unsigned int getStatResponses(void);
90 
92  void setClientsNumber(unsigned int clientsNumber);
93  unsigned int getClientsNumber(void);
94 
96  void setNodeMode(unsigned char nodeMode);
97  unsigned char getNodeMode(void);
98 
101 
102  //Sphinx reducer FO
104 
105  //TODO: only for model purposes, need to be removed in final version
107  std::map<std::string, DefaultReducerResponseItem*> _responses;
108  };
109 
110  }
111 }
112 
113 #endif /* __HCE_DATAREDUCER_PROXY_INCLUDED__ */