0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RangeMoveSpec.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_Lib_RangeMoveSpec_h
28 #define Hypertable_Lib_RangeMoveSpec_h
29 
32 
33 #include <Common/Serializable.h>
34 
35 #include <memory>
36 
37 namespace Hypertable {
38 
41 
43  class RangeMoveSpec : public Serializable {
44  public:
45 
47  RangeMoveSpec(const char *src, const char *dest, const char* table_id,
48  const char *start_row, const char *end_row) {
49  clear();
50  source_location = src;
51  dest_location = dest;
52  table.set_id(table_id);
53  range.set_start_row(start_row);
54  range.set_end_row(end_row);
55  }
56 
57  void clear() {
58  table.id = 0;
59  table.generation = 0;
60  range.start_row = 0;
61  range.end_row = 0;
62  source_location.clear();
63  dest_location.clear();
64  error = 0;
65  complete = false;
66  }
67 
70  std::string source_location;
71  std::string dest_location;
72  int32_t error {};
73  bool complete {};
74 
75  private:
76 
79  uint8_t encoding_version() const override;
80 
84  size_t encoded_length_internal() const override;
85 
88  void encode_internal(uint8_t **bufp) const override;
89 
96  void decode_internal(uint8_t version, const uint8_t **bufp,
97  size_t *remainp) override;
98 
99  };
100 
101  typedef std::shared_ptr<RangeMoveSpec> RangeMoveSpecPtr;
102 
103  std::ostream &operator<<(std::ostream &os, const RangeMoveSpec &move_spec);
104 
106 
107 }
108 
109 #endif // Hypertable_Lib_RangeMoveSpec_h
TableIdentifierManaged table
Definition: RangeMoveSpec.h:68
Declarations for TableIdentifier and TableIdentifierManaged.
Range move specification.
Definition: RangeMoveSpec.h:43
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
Wrapper for TableIdentifier providing member storage.
void set_start_row(const std::string &s)
Definition: RangeSpec.h:112
const char * end_row
Definition: RangeSpec.h:60
RangeSpecManaged range
Definition: RangeMoveSpec.h:69
uint8_t encoding_version() const override
Returns encoding version.
std::ostream & operator<<(std::ostream &os, const crontab_entry &entry)
Helper function to write crontab_entry to an ostream.
Definition: Crontab.cc:301
RangeMoveSpec(const char *src, const char *dest, const char *table_id, const char *start_row, const char *end_row)
Definition: RangeMoveSpec.h:47
Declarations for RangeSpec and RangeSpecManaged.
Declarations for Serializable.
Hypertable definitions
void set_id(const std::string &new_name)
const char * start_row
Definition: RangeSpec.h:59
Mixin class that provides a standard serialization interface.
Definition: Serializable.h:65
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
std::shared_ptr< RangeMoveSpec > RangeMoveSpecPtr
void set_end_row(const std::string &e)
Definition: RangeSpec.h:116
size_t encoded_length_internal() const override
Returns internal serialized length.
Wrapper for RangeSpec providing member storage.
Definition: RangeSpec.h:89