summaryrefslogtreecommitdiffstats
path: root/src/mon/ConfigMonitor.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/mon/ConfigMonitor.h
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/mon/ConfigMonitor.h')
-rw-r--r--src/mon/ConfigMonitor.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/mon/ConfigMonitor.h b/src/mon/ConfigMonitor.h
new file mode 100644
index 000000000..e6c12a3d7
--- /dev/null
+++ b/src/mon/ConfigMonitor.h
@@ -0,0 +1,58 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <boost/optional.hpp>
+
+#include "ConfigMap.h"
+#include "mon/PaxosService.h"
+
+class MonSession;
+
+class ConfigMonitor : public PaxosService
+{
+ version_t version = 0;
+ ConfigMap config_map;
+ std::map<std::string,boost::optional<ceph::buffer::list>> pending;
+ std::string pending_description;
+ std::map<std::string,boost::optional<ceph::buffer::list>> pending_cleanup;
+
+ std::map<std::string,ceph::buffer::list> current;
+
+ void encode_pending_to_kvmon();
+
+public:
+ ConfigMonitor(Monitor &m, Paxos &p, const std::string& service_name);
+
+ void init() override;
+
+ void load_config();
+ void load_changeset(version_t v, ConfigChangeSet *ch);
+
+ bool preprocess_query(MonOpRequestRef op) override;
+ bool prepare_update(MonOpRequestRef op) override;
+
+ bool preprocess_command(MonOpRequestRef op);
+ bool prepare_command(MonOpRequestRef op);
+
+ void handle_get_config(MonOpRequestRef op);
+
+ void create_initial() override;
+ void update_from_paxos(bool *need_bootstrap) override;
+ void create_pending() override;
+ void encode_pending(MonitorDBStore::TransactionRef t) override;
+ version_t get_trim_to() const override;
+
+ void encode_full(MonitorDBStore::TransactionRef t) override { }
+
+ void on_active() override;
+ void tick() override;
+
+ bool refresh_config(MonSession *s);
+ bool maybe_send_config(MonSession *s);
+ void send_config(MonSession *s);
+ void check_sub(MonSession *s);
+ void check_sub(Subscription *sub);
+ void check_all_subs();
+};