1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2009 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 * The Monmap Monitor is used to track the monitors in the cluster.
19 #ifndef CEPH_MONMAPMONITOR_H
20 #define CEPH_MONMAPMONITOR_H
27 #include "include/types.h"
28 #include "msg/Messenger.h"
30 #include "PaxosService.h"
32 #include "MonitorDBStore.h"
39 class MonmapMonitor : public PaxosService {
41 MonmapMonitor(Monitor *mn, Paxos *p, const string& service_name)
42 : PaxosService(mn, p, service_name)
45 MonMap pending_map; //the pending map awaiting passage
47 void create_initial() override;
49 void update_from_paxos(bool *need_bootstrap) override;
51 void create_pending() override;
53 void encode_pending(MonitorDBStore::TransactionRef t) override;
54 // we always encode the full map; we have no use for full versions
55 void encode_full(MonitorDBStore::TransactionRef t) override { }
57 void on_active() override;
58 void apply_mon_features(const mon_feature_t& features);
60 void dump_info(Formatter *f);
62 bool preprocess_query(MonOpRequestRef op) override;
63 bool prepare_update(MonOpRequestRef op) override;
65 bool preprocess_join(MonOpRequestRef op);
66 bool prepare_join(MonOpRequestRef op);
68 bool preprocess_command(MonOpRequestRef op);
69 bool prepare_command(MonOpRequestRef op);
71 void get_health(list<pair<health_status_t,string> >& summary,
72 list<pair<health_status_t,string> > *detail,
73 CephContext *cct) const override;
75 int get_monmap(bufferlist &bl);
78 * Since monitors are pretty
79 * important, this implementation will just write 0.0.
81 bool should_propose(double& delay) override;
83 void check_sub(Subscription *sub);