0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Plan.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 2 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_RangeServerRecovery_Plan_h
28 #define Hypertable_Lib_RangeServerRecovery_Plan_h
29 
30 #include "ReceiverPlan.h"
31 #include "ReplayPlan.h"
32 
34 
35 #include <Common/Serializable.h>
36 #include <Common/Serialization.h>
37 #include <Common/String.h>
38 
39 #include <memory>
40 
41 namespace Hypertable {
42 namespace Lib {
43 namespace RangeServerRecovery {
44 
47 
49  class Plan : public Serializable {
50  public:
51  Plan() : type(RangeSpec::UNKNOWN) { }
52  Plan(int type_) : type(type_) { }
53 
54  void clear() {
58  }
59 
60  friend std::ostream &operator<<(std::ostream &os, const Plan &plan) {
61  os << "{Plan: type=" << plan.type << ", replay_plan="
62  << plan.replay_plan << ", receiver_plan=" << plan.receiver_plan << "}";
63  return os;
64  }
65 
67  int type;
68 
71 
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 
102  typedef std::shared_ptr<Plan> PlanPtr;
103 
105 
106 }}}
107 
108 #endif // Hypertable_Lib_RangeServerRecovery_Plan_h
Range specification.
Definition: RangeSpec.h:40
Declarations for ReplayPlan.
RangeServer recovery plan.
Definition: Plan.h:49
ReplayPlan replay_plan
Replay plan.
Definition: Plan.h:70
size_t encoded_length_internal() const override
Returns internal serialized length.
Definition: Plan.cc:38
Functions to serialize/deserialize primitives to/from a memory buffer.
Declarations for RangeSpec and RangeSpecManaged.
Declarations for Serializable.
Hypertable definitions
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
Definition: Plan.cc:62
Mixin class that provides a standard serialization interface.
Definition: Serializable.h:65
std::shared_ptr< Plan > PlanPtr
Smart pointer to Plan.
Definition: Plan.h:102
A String class based on std::string.
uint8_t encoding_version() const override
Returns encoding version.
Definition: Plan.cc:34
ReceiverPlan receiver_plan
Receiver plan.
Definition: Plan.h:73
friend std::ostream & operator<<(std::ostream &os, const Plan &plan)
Definition: Plan.h:60
Holds a fragment replay plan for the recovery of a RangeServer.
Definition: ReplayPlan.h:53
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
Definition: Plan.cc:68
RangeServer recovery receiver plan.
Definition: ReceiverPlan.h:48