0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MaintenanceTask.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Hypertable_RangeServer_MaintenanceTask_h
23 #define Hypertable_RangeServer_MaintenanceTask_h
24 
25 #include "Common/Time.h"
26 
27 #include "MaintenanceFlag.h"
28 #include "Range.h"
29 
30 #include <chrono>
31 
32 namespace Hypertable {
33 
35  public:
36 
37  MaintenanceTask(uint32_t _level, int _priority,
38  std::chrono::time_point<std::chrono::steady_clock> &stime,
39  RangePtr &range, const String &desc)
40  : start_time(stime), level(_level), priority(_priority), m_range(range),
41  m_description(desc) { }
42 
43  MaintenanceTask(uint32_t _level, int _priority, const String &desc) :
44  level(_level), priority(_priority), m_description(desc) {
45  start_time = std::chrono::steady_clock::now();
46  }
47 
48  virtual ~MaintenanceTask() { }
49 
50  virtual void execute() = 0;
51 
53 
54  bool retry() { return m_retry; }
55  void set_retry(bool retry) { m_retry = retry; }
56 
57  uint32_t get_retry_delay() { return m_retry_delay_millis; }
58  void set_retry_delay(uint32_t delay) { m_retry_delay_millis = delay; }
59 
60  int get_priority() { return priority; }
61  void set_priority(int p) { priority = p; }
62 
63  Range *get_range() { return m_range.get(); }
64 
65  void add_subtask(const void *obj, int flags) {
66  m_map[obj] = flags;
67  }
68 
69  std::chrono::time_point<std::chrono::steady_clock> start_time;
70  uint32_t level;
71  int priority;
72 
73  protected:
76 
77  private:
78  bool m_retry {};
81  };
82 
83 }
84 
85 #endif // Hypertable_RangeServer_MaintenanceTask_h
void add_subtask(const void *obj, int flags)
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Maps object pointers to bit fields.
void set_retry_delay(uint32_t delay)
MaintenanceTask(uint32_t _level, int _priority, const String &desc)
Represents a table row range.
Definition: Range.h:69
virtual void execute()=0
Declarations for Range.
Time related declarations.
Hypertable definitions
std::chrono::time_point< std::chrono::steady_clock > start_time
std::shared_ptr< Range > RangePtr
Smart pointer to Range.
Definition: Range.h:404
MaintenanceFlag::Map m_map
Declarations for MaintenanceFlag This file contains declarations that are part of the MaintenanceFlag...
MaintenanceTask(uint32_t _level, int _priority, std::chrono::time_point< std::chrono::steady_clock > &stime, RangePtr &range, const String &desc)