From 8757ba2caaf64fda72dfc655945f5483332fabf4 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 28 Nov 2020 21:23:38 +0800 Subject: [PATCH] mon/ConfigKeyService: remove unused bits Signed-off-by: Kefu Chai --- src/mon/ConfigKeyService.cc | 67 +++---------------------------------- src/mon/ConfigKeyService.h | 32 ------------------ 2 files changed, 4 insertions(+), 95 deletions(-) diff --git a/src/mon/ConfigKeyService.cc b/src/mon/ConfigKeyService.cc index 4f5c937001fe3..3e713833edf96 100644 --- a/src/mon/ConfigKeyService.cc +++ b/src/mon/ConfigKeyService.cc @@ -59,36 +59,19 @@ using ceph::parse_timespan; using ceph::timespan_str; static ostream& _prefix(std::ostream *_dout, const Monitor &mon, - const ConfigKeyService *service) { + const ConfigKeyService *service) +{ return *_dout << "mon." << mon.name << "@" << mon.rank - << "(" << mon.get_state_name() << ")." << service->get_name() - << "(" << service->get_epoch() << ") "; + << "(" << mon.get_state_name() << ")." << service->get_name(); } const string CONFIG_PREFIX = "mon_config_key"; ConfigKeyService::ConfigKeyService(Monitor &m, Paxos &p) : mon(m), - paxos(p), - tick_period(g_conf()->mon_tick_interval) + paxos(p) {} -void ConfigKeyService::start(epoch_t new_epoch) -{ - epoch = new_epoch; - start_epoch(); -} - -void ConfigKeyService::finish() -{ - generic_dout(20) << "ConfigKeyService::finish" << dendl; - finish_epoch(); -} - -epoch_t ConfigKeyService::get_epoch() const { - return epoch; -} - bool ConfigKeyService::dispatch(MonOpRequestRef op) { return service_dispatch(op); } @@ -98,48 +81,6 @@ bool ConfigKeyService::in_quorum() const return (mon.is_leader() || mon.is_peon()); } -void ConfigKeyService::start_tick() -{ - generic_dout(10) << __func__ << dendl; - - cancel_tick(); - if (tick_period <= 0) - return; - - tick_event = new C_MonContext{&mon, [this](int r) { - if (r < 0) { - return; - } - tick(); - }}; - mon.timer.add_event_after(tick_period, tick_event); -} - -void ConfigKeyService::set_update_period(double t) -{ - tick_period = t; -} - -void ConfigKeyService::cancel_tick() -{ - if (tick_event) - mon.timer.cancel_event(tick_event); - tick_event = nullptr; -} - -void ConfigKeyService::tick() -{ - service_tick(); - start_tick(); -} - -void ConfigKeyService::shutdown() -{ - generic_dout(0) << "quorum service shutdown" << dendl; - cancel_tick(); - service_shutdown(); -} - int ConfigKeyService::store_get(const string &key, bufferlist &bl) { return mon.store->get(CONFIG_PREFIX, key, bl); diff --git a/src/mon/ConfigKeyService.h b/src/mon/ConfigKeyService.h index 3d0dfebe3bf44..412ae424f0dc8 100644 --- a/src/mon/ConfigKeyService.h +++ b/src/mon/ConfigKeyService.h @@ -24,28 +24,12 @@ class Monitor; class ConfigKeyService { public: - enum { - SERVICE_HEALTH = 0x01, - SERVICE_TIMECHECK = 0x02, - SERVICE_CONFIG_KEY = 0x03, - }; ConfigKeyService(Monitor &m, Paxos &p); ~ConfigKeyService() {} - void start(epoch_t new_epoch); - void finish(); - void shutdown(); - - void init() { } bool dispatch(MonOpRequestRef op); bool service_dispatch(MonOpRequestRef op); - void start_epoch() { } - void finish_epoch() { } - epoch_t get_epoch() const; - void cleanup() { } - void service_tick() { } - int validate_osd_destroy(const int32_t id, const uuid_d& uuid); void do_osd_destroy(int32_t id, uuid_d& uuid); int validate_osd_new( @@ -54,33 +38,17 @@ public: std::stringstream& ss); void do_osd_new(const uuid_d& uuid, const std::string& dmcrypt_key); - int get_type() { - return SERVICE_CONFIG_KEY; - } - std::string get_name() const { return "config_key"; } void get_store_prefixes(std::set& s) const; -protected: - void service_shutdown() { } - private: Monitor &mon; Paxos &paxos; - epoch_t epoch = 0; bool in_quorum() const; - void start_tick(); - void cancel_tick(); - void tick(); - void set_update_period(double t); - - Context *tick_event = nullptr; - double tick_period; - int store_get(const std::string &key, ceph::buffer::list &bl); void store_put(const std::string &key, ceph::buffer::list &bl, Context *cb = NULL); void store_delete(MonitorDBStore::TransactionRef t, const std::string &key); -- 2.39.5