mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
crimson/mon: add mon::Client::wait_for_config()
just for waiting for monmap and config from mon. crimson-osd needs this for populating settings related to booting and transport layer before it starts. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
264e710a37
commit
9a248da3fe
@ -894,7 +894,11 @@ seastar::future<> Client::handle_log_ack(Ref<MLogAck> m)
|
||||
|
||||
seastar::future<> Client::handle_config(Ref<MConfig> m)
|
||||
{
|
||||
return crimson::common::local_conf().set_mon_vals(m->config);
|
||||
return crimson::common::local_conf().set_mon_vals(m->config).then([this] {
|
||||
if (config_updated) {
|
||||
config_updated->set_value();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
std::vector<unsigned> Client::get_random_mons(unsigned n) const
|
||||
@ -1110,6 +1114,13 @@ seastar::future<> Client::renew_subs()
|
||||
});
|
||||
}
|
||||
|
||||
seastar::future<> Client::wait_for_config()
|
||||
{
|
||||
assert(!config_updated);
|
||||
config_updated = seastar::promise<>();
|
||||
return config_updated->get_future();
|
||||
}
|
||||
|
||||
void Client::print(std::ostream& out) const
|
||||
{
|
||||
out << "mon." << entity_name;
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
void sub_unwant(const std::string& what);
|
||||
bool sub_want_increment(const std::string& what, version_t start, unsigned flags);
|
||||
seastar::future<> renew_subs();
|
||||
seastar::future<> wait_for_config();
|
||||
|
||||
void print(std::ostream&) const;
|
||||
private:
|
||||
@ -173,6 +174,7 @@ private:
|
||||
seastar::promise<> pr;
|
||||
};
|
||||
std::deque<pending_msg_t> pending_messages;
|
||||
std::optional<seastar::promise<>> config_updated;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, const Client& client) {
|
||||
|
Loading…
Reference in New Issue
Block a user