0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationAlterTable.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_OperationAlterTable_h
28 #define Hypertable_Master_OperationAlterTable_h
29 
31 
33 
34 #include <Common/StringExt.h>
35 
36 namespace Hypertable {
37 
40 
42  class OperationAlterTable : public Operation {
43  public:
44 
49  OperationAlterTable(ContextPtr &context, const MetaLog::EntityHeader &header_);
50 
59  OperationAlterTable(ContextPtr &context, EventPtr &event);
60 
62  virtual ~OperationAlterTable() { }
63 
65  void execute() override;
66 
70  const String name() override;
71 
75  const String label() override;
76 
80  void display_state(std::ostream &os) override;
81 
84  uint8_t encoding_version_state() const override;
85 
91  size_t encoded_length_state() const override;
92 
113  void encode_state(uint8_t **bufp) const override;
114 
125  void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override;
126 
127  void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override;
128 
129  private:
130 
143  bool get_schemas(SchemaPtr &original_schema, SchemaPtr &alter_schema);
144 
153  TableParts get_drop_index_parts(SchemaPtr &original_schema,
154  SchemaPtr &alter_schema);
155 
165  SchemaPtr &alter_schema);
166 
169 
172 
175 
178 
181 
184 
185  };
186 
188 
189 } // namespace Hypertable
190 
191 #endif // Hypertable_Master_OperationAlterTable_h
std::set< String > StringSet
STL Set managing Strings.
Definition: StringExt.h:42
TableParts get_create_index_parts(SchemaPtr &original_schema, SchemaPtr &alter_schema)
Determines which index tables to create.
Request parameters for alter table operation.
Definition: AlterTable.h:46
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Declarations for Operation.
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Declarations for AlterTable request parameters.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Definition: Event.h:228
OperationAlterTable(ContextPtr &context, const MetaLog::EntityHeader &header_)
Constructor for constructing object from MetaLog entry.
Represents a set of table parts (sub-tables).
Definition: TableParts.h:47
bool get_schemas(SchemaPtr &original_schema, SchemaPtr &alter_schema)
Gets schema objects.
Carries out an alter table operation.
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
TableParts m_parts
Index tables to be created or dropped.
void encode_state(uint8_t **bufp) const override
Writes serialized encoding of object state.
void execute() override
Carries out the alter table operation.
Hypertable definitions
TableParts get_drop_index_parts(SchemaPtr &original_schema, SchemaPtr &alter_schema)
Determines which index tables to drop.
String m_schema
Schema for the table
size_t encoded_length_state() const override
Returns serialized state length.
Abstract base class for master operations.
Definition: Operation.h:124
void display_state(std::ostream &os) override
Writes human readable representation of object to output stream.
uint8_t encoding_version_state() const override
Returns encoding version.
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
Definition: Schema.h:465
const String name() override
Returns name of operation ("OperationAlterTable")
virtual ~OperationAlterTable()
Destructor.
StringSet m_completed
Set of range servers that have completed operation.
String extensions and helpers: sets, maps, append operators etc.
Lib::Master::Request::Parameters::AlterTable m_params
Request parmaeters.
const String label() override
Returns descriptive label for operation.
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized encoding of object state.
StringSet m_servers
Set of participating range servers.