28 #ifndef Hypertable_Master_BalancePlanAuthority_h
29 #define Hypertable_Master_BalancePlanAuthority_h
33 #include <boost/thread/condition.hpp>
124 void create_recovery_plan(
const String &location,
125 const vector<QualifiedRangeSpec> &root_specs,
126 const vector<RangeState> &root_states,
127 const vector<QualifiedRangeSpec> &metadata_specs,
128 const vector<RangeState> &metadata_states,
129 const vector<QualifiedRangeSpec> &system_specs,
130 const vector<RangeState> &system_states,
131 const vector<QualifiedRangeSpec> &user_specs,
132 const vector<RangeState> &user_states);
142 void copy_recovery_plan(
const String &location,
int type,
152 void remove_recovery_plan(
const String &location);
162 void remove_from_receiver_plan(
const String &location,
int type,
163 const vector<QualifiedRangeSpec> &ranges);
171 void remove_table_from_receiver_plan(
const String &table_id);
182 void change_receiver_plan_location(
const String &location,
int type,
183 const String &old_destination,
184 const String &new_destination);
191 void get_receiver_plan_locations(
const String &location,
int type,
200 bool recovery_complete(
const String &location,
int type);
207 int get_generation() { std::lock_guard<std::mutex> lock(m_mutex);
return m_generation; }
213 std::lock_guard<std::mutex> lock(m_mutex);
214 m_generation = new_generation;
220 m_current_set.clear();
237 std::vector<MetaLog::EntityPtr> &entities);
273 const String name()
override {
return "BalancePlanAuthority"; }
281 void display(std::ostream &os)
override;
293 void decode(
const uint8_t **bufp,
size_t *remainp,
294 uint16_t definition_version)
override;
298 uint8_t encoding_version()
const override;
300 size_t encoded_length_internal()
const override;
302 void encode_internal(uint8_t **bufp)
const override;
304 void decode_internal(uint8_t version,
const uint8_t **bufp,
305 size_t *remainp)
override;
307 void decode_old(
const uint8_t **bufp,
size_t *remainp);
328 const vector<QualifiedRangeSpec> &specs,
329 const vector<RangeState> &states);
343 const vector<QualifiedRangeSpec> &new_specs);
380 int cmp = strcmp(ms1->table.id, ms2->table.id);
384 if (ms1->range < ms2->range)
392 typedef std::set<RangeMoveSpecPtr, lt_move_spec>
MoveSetT;
405 #endif // Hypertable_Master_BalancePlanAuthority_h
std::set< String > StringSet
STL Set managing Strings.
void set_generation(int new_generation)
Sets the generation number (TESTING ONLY).
int get_generation()
Returns the current generation number.
std::string String
A String is simply a typedef to std::string.
std::shared_ptr< BalancePlan > BalancePlanPtr
std::set< RangeMoveSpecPtr, lt_move_spec > MoveSetT
Set of RangeMoveSpecPtr.
MetaLog::WriterPtr m_mml_writer
Pointer to MML writer.
RangeServer recovery plan.
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
bool operator()(const RangeMoveSpecPtr &ms1, const RangeMoveSpecPtr &ms2) const
MoveSetT m_current_set
Current set of move specifications for move operations.
ContextPtr m_context
Pointer to master context.
Central authority for balance plans.
std::map< String, RecoveryPlans > RecoveryPlanMap
Server-to-plan map.
const String name() override
Returns the name of this entity ("BalancePlanAuthority")
std::shared_ptr< Writer > WriterPtr
Smart pointer to Writer.
std::shared_ptr< Plan > PlanPtr
Smart pointer to Plan.
Holds plans for each range type.
StrictWeakOrdering class for set of RangeMoveSpecs.
virtual ~BalancePlanAuthority()
Destructor.
std::shared_ptr< RangeMoveSpec > RangeMoveSpecPtr
void clear_current_set()
Clears the m_current_set of move specifications (TESTING ONLY).
int m_generation
Generation number (incremented with each new failover plan)
std::shared_ptr< BalancePlanAuthority > BalancePlanAuthorityPtr
Smart pointer to BalancePlanAuthority.
StringSet::iterator m_active_iter
Iterator pointing into m_active.
Declarations for Context.
RecoveryPlanMap m_map
Mapping from failed range server to recovery plan.
StringSet m_active
Cache of active (available) servers.