summaryrefslogtreecommitdiffstats
path: root/src/mon/MonmapMonitor.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/mon/MonmapMonitor.h
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/mon/MonmapMonitor.h')
-rw-r--r--src/mon/MonmapMonitor.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/mon/MonmapMonitor.h b/src/mon/MonmapMonitor.h
new file mode 100644
index 00000000..fc0bfdbd
--- /dev/null
+++ b/src/mon/MonmapMonitor.h
@@ -0,0 +1,83 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2009 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+/*
+ * The Monmap Monitor is used to track the monitors in the cluster.
+ */
+
+#ifndef CEPH_MONMAPMONITOR_H
+#define CEPH_MONMAPMONITOR_H
+
+#include <map>
+#include <set>
+
+#include "include/types.h"
+#include "msg/Messenger.h"
+
+#include "PaxosService.h"
+#include "MonMap.h"
+#include "MonitorDBStore.h"
+
+class MonmapMonitor : public PaxosService {
+ public:
+ MonmapMonitor(Monitor *mn, Paxos *p, const string& service_name)
+ : PaxosService(mn, p, service_name)
+ {
+ }
+ MonMap pending_map; //the pending map awaiting passage
+
+ void create_initial() override;
+
+ void update_from_paxos(bool *need_bootstrap) override;
+
+ void create_pending() override;
+
+ void encode_pending(MonitorDBStore::TransactionRef t) override;
+ // we always encode the full map; we have no use for full versions
+ void encode_full(MonitorDBStore::TransactionRef t) override { }
+
+ void on_active() override;
+ void apply_mon_features(const mon_feature_t& features,
+ int min_mon_release);
+
+ void dump_info(Formatter *f);
+
+ bool preprocess_query(MonOpRequestRef op) override;
+ bool prepare_update(MonOpRequestRef op) override;
+
+ bool preprocess_join(MonOpRequestRef op);
+ bool prepare_join(MonOpRequestRef op);
+
+ bool preprocess_command(MonOpRequestRef op);
+ bool prepare_command(MonOpRequestRef op);
+
+ int get_monmap(bufferlist &bl);
+
+ /*
+ * Since monitors are pretty
+ * important, this implementation will just write 0.0.
+ */
+ bool should_propose(double& delay) override;
+
+ void check_sub(Subscription *sub);
+
+ void tick() override;
+
+private:
+ void check_subs();
+ bufferlist monmap_bl;
+};
+
+
+#endif