0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationToggleTableMaintenance.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 
26 
27 #ifndef Hypertable_Master_OperationToggleTableMaintenance_h
28 #define Hypertable_Master_OperationToggleTableMaintenance_h
29 
30 #include "Operation.h"
31 
32 namespace Hypertable {
33 
36 
38  namespace TableMaintenance {
40  const bool OFF = false;
42  const bool ON = true;
43  }
44 
47  public:
48 
58  const std::string &table_name,
59  bool toggle_on);
60 
66 
69 
71  void execute() override;
72 
75  const String name() override;
76 
79  const String label() override;
80 
83  void display_state(std::ostream &os) override;
84 
85  uint8_t encoding_version_state() const override;
86 
92  size_t encoded_length_state() const override;
93 
126  void encode_state(uint8_t **bufp) const override;
127 
137  void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override;
138 
139  void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override;
140 
141  private:
142 
144  std::string m_name;
145 
147  std::string m_id;
148 
150  std::set<std::string> m_servers;
151 
153  std::set<std::string> m_completed;
154 
156  bool m_toggle_on {};
157  };
158 
160 
161 }
162 
163 #endif // Hypertable_Master_OperationToggleTableMaintenance_h
std::set< std::string > m_servers
Set of range servers participating in toggle.
void execute() override
Carries out a toggle maintenance operation.
const bool OFF
Constant representing off
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
std::set< std::string > m_completed
Set of range servers that have completed toggle.
Declarations for Operation.
void encode_state(uint8_t **bufp) const override
Writes serialized encoding of object state.
EntityHeader header
Entity header
const String name() override
Returns name of operation ("OperationToggleTableMaintenance")
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
size_t encoded_length_state() const override
Returns serialized state length.
const String label() override
Returns descriptive label for operation.
OperationToggleTableMaintenance(ContextPtr &context, const std::string &table_name, bool toggle_on)
Constructor.
bool m_toggle_on
Flag indicating if maintenance is to be toggled on or off.
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized encoding of object state.
Hypertable definitions
const bool ON
Constant representing on
void display_state(std::ostream &os) override
Writes human readable representation of object to output stream.
Enables or disables maintenance for a table.
Abstract base class for master operations.
Definition: Operation.h:124
uint8_t encoding_version_state() const override
Returns version of encoding format of state.