hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReducerFunctionalObject.hpp
Go to the documentation of this file.
1 
14 #ifndef REDUCERFUNCTIONALOBJECT_HPP_
15 #define REDUCERFUNCTIONALOBJECT_HPP
16 
19 #include <Poco/SharedPtr.h>
20 
21 namespace HCE{
22 namespace reduce{
23 
24 const int OK = 0;
27 const std::string WRONG_JSON_STRUCT_DESCR = "err string";
28 const std::string NOT_FOUND_ITEM_ID_DESCR = "err string2";
29 
31  public:
34 
35  void accumulate(std::string& jsonReducingInputMessage, unsigned long long itemId);
36  bool isCompleteTask(unsigned long long itemId, int nodesCount,
37  unsigned int ttl = USE_TASK_TTL_VALUE);
38  Poco::SharedPtr<HCE::reduce_types::ReducingOutputMessage> reduce(unsigned long long itemId);
39 
40  unsigned int getTasksNumber();
41  int getErrCode() const;
42  std::string getErrMsg() const;
43 
44  int cleanupExpiredTasksByTTL(unsigned int maxRemoveTasks = 1,
45  unsigned int ttl = USE_TASK_TTL_VALUE);
46  unsigned int cleanupExpiredTasksByTTLQueue(unsigned int maxRemoveItems,
47  unsigned int minTerminateTime );
48  void getExceededTTLTasks( unsigned int maxTaskNumber,
49  std::vector<unsigned long long>& exceededTTLTasks,
50  unsigned int ttl = USE_TASK_TTL_VALUE);
51  int getRejectedMessages() const;
52 
53  private:
54  Poco::SharedPtr<HCE::reduce::ReducingHandler>_reducingHandler;
55  HCE::reduce_convertors::PocoJSONReducingInputMessageConvertor _pocoJSONReducingInputMessageConvertor;
56  int errCode;
57  std::string errMsg;
58  int _rejectedMessages;
59 };
60 
61 }
62 }
63 
64 #endif