0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MaintenancePrioritizer.h
Go to the documentation of this file.
1 /*
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_MaintenancePrioritizer_h
23 #define Hypertable_RangeServer_MaintenancePrioritizer_h
24 
25 #include "Global.h"
26 
27 #include <Common/Logger.h>
28 #include <Common/Time.h>
29 
30 namespace Hypertable {
31 
33  public:
34 
35  class MemoryState {
36  public:
37  MemoryState() : limit(0), balance(0), needed(0) { }
38  void decrement_needed(int64_t amount) {
39  if (amount > needed)
40  needed = 0;
41  else
42  needed -= amount;
43  }
44  bool need_more() { return needed > 0; }
45  int64_t limit;
46  int64_t balance;
47  int64_t needed;
48  };
49 
52 
53  virtual void prioritize(std::vector<RangeData> &range_data, MemoryState &memory_state,
54  int32_t priority, String *trace) = 0;
55 
56  protected:
57 
60 
61  void schedule_initialization_operations(std::vector<RangeData> &range_data,
62  int32_t &priority);
63 
64  bool schedule_inprogress_operations(std::vector<RangeData> &range_data,
65  MemoryState &memory_state,
66  int32_t &priority, String *trace);
67 
68  bool schedule_splits_and_relinquishes(std::vector<RangeData> &range_data,
69  MemoryState &memory_state,
70  int32_t &priority, String *trace);
71 
72  bool schedule_necessary_compactions(std::vector<RangeData> &range_data,
73  CommitLogPtr &log, int64_t prune_threshold,
74  MemoryState &memory_state,
75  int32_t &priority, String *trace);
76 
77  bool purge_shadow_caches(std::vector<RangeData> &range_data,
78  MemoryState &memory_state,
79  int32_t &priority, String *trace);
80 
81  bool purge_cellstore_indexes(std::vector<RangeData> &range_data,
82  MemoryState &memory_state,
83  int32_t &priority, String *trace);
84 
85  bool compact_cellcaches(std::vector<RangeData> &range_data,
86  MemoryState &memory_state,
87  int32_t &priority, String *trace);
88 
89 
90  };
91 
92 }
93 
94 #endif // Hypertable_RangeServer_MaintenancePrioritizer_h
95 
96 
bool compact_cellcaches(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t &priority, String *trace)
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
bool purge_shadow_caches(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t &priority, String *trace)
void schedule_initialization_operations(std::vector< RangeData > &range_data, int32_t &priority)
bool purge_cellstore_indexes(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t &priority, String *trace)
bool schedule_inprogress_operations(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t &priority, String *trace)
bool schedule_splits_and_relinquishes(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t &priority, String *trace)
Logging routines and macros.
Time related declarations.
Hypertable definitions
virtual void prioritize(std::vector< RangeData > &range_data, MemoryState &memory_state, int32_t priority, String *trace)=0
std::shared_ptr< CommitLog > CommitLogPtr
Smart pointer to CommitLog.
Definition: CommitLog.h:223
bool schedule_necessary_compactions(std::vector< RangeData > &range_data, CommitLogPtr &log, int64_t prune_threshold, MemoryState &memory_state, int32_t &priority, String *trace)