hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReducingHandler.hpp
Go to the documentation of this file.
1 
14 #ifndef REDUCINGHANDLER_HPP_
15 #define REDUCINGHANDLER_HPP_
16 
21 #include "ReducingInputMessage.hpp"
23 #include "SupportNotifierIf.hpp"
25 #include <Poco/SharedPtr.h>
26 
27 namespace HCE{
28 namespace reduce{
29 
31 public:
33  const Poco::SharedPtr<ReducingPartsCountersStorageIf>& reducingPartsCountersStorage,
34  const Poco::SharedPtr<ReduceAdditionsStorageIf>& reduceAdditionsStorage,
35  const Poco::SharedPtr<TaskReducersManagerFactoryIf> &taskReducersManagerFactory,
36  const Poco::SharedPtr<ReducingOutputMessageBuilderIf>& reducingOutputMessageBuilder,
37  const Poco::SharedPtr<SupportNotifierIf>& supportNotifier);
38  virtual ~ReducingHandler();
39 
40  void accumulateReducingData(unsigned long long itemId,
41  Poco::SharedPtr<reduce_types::ReducingInputMessage>& reducingInputMessage);
42  Poco::SharedPtr<reduce_types::ReducingOutputMessage> makeReducing(unsigned long long itemId);
43  void deleteReducingTaskBy(unsigned long long itemId);
44 
45  int getAccumulateReducingPartsNumberBy(unsigned long long itemId);
46  unsigned int getTasksNumber();
47  bool isTaskTerminatedByTTL( unsigned long long taskId ) const;
48  bool isTaskExpired( unsigned long long taskId, unsigned int ttl = USE_TASK_TTL_VALUE);
49  int cleanupExpiredTasksByTTL(unsigned int maxRemoveTasks = 1, unsigned int ttl = USE_TASK_TTL_VALUE);
50  unsigned int cleanupExpiredTasksByTTLQueue( unsigned int maxRemoveItems, unsigned int minTerminateTime );
51  void getExceededTTLTasks( unsigned int maxTaskNumber, std::vector<unsigned long long>& exceededTTLTasks,
52  unsigned int ttl = USE_TASK_TTL_VALUE) const;
53 
54 private:
55  Poco::SharedPtr<ReducingPartsCountersStorageIf> _reducingPartsCountersStorage;
56  Poco::SharedPtr<ReduceAdditionsStorageIf> _reduceAdditionsStorage;
57  Poco::SharedPtr<TaskReducersManagerFactoryIf> _taskReducersManagerFactory;
58  Poco::SharedPtr<ReducingOutputMessageBuilderIf> _reducingOutputMessageBuilder;
59  Poco::SharedPtr<SupportNotifierIf> _supportNotifier;
60  ReducingTaskTTLManager _taskTTLManager;
61 
63  void createNewTaskReducersManager(HCE::types::MessageType reducerType);
64 };
65 
66 }
67 }
68 
69 #endif