crimson/osdmap_service: add get_mnow(), get_up_epoch()

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-07-22 11:58:40 -05:00
parent 94b39c1c69
commit 91c0df8121
3 changed files with 15 additions and 0 deletions

View File

@ -185,6 +185,8 @@ seastar::future<> OSD::start()
{
logger().info("start");
startup_time = ceph::mono_clock::now();
return store->mount().then([this] {
meta_coll = make_unique<OSDMeta>(store->open_collection(coll_t::meta()),
store.get());
@ -526,6 +528,11 @@ MessageRef OSD::get_stats()
return m;
}
ceph::signedspan OSD::get_mnow() const
{
return ceph::mono_clock::now() - startup_time;
}
OSD::cached_map_t OSD::get_map() const
{
return osdmap;

View File

@ -92,6 +92,8 @@ class OSD final : public ceph::net::Dispatcher,
//< since when there is no more pending pg creates from mon
epoch_t last_pg_create_epoch = 0;
ceph::mono_time startup_time;
OSDSuperblock superblock;
// Dispatcher methods
@ -137,6 +139,10 @@ private:
seastar::future<> _send_alive();
// OSDMapService methods
ceph::signedspan get_mnow() const final;
epoch_t get_up_epoch() const final {
return up_epoch;
}
seastar::future<cached_map_t> get_map(epoch_t e) final;
cached_map_t get_map() const final;
seastar::future<std::unique_ptr<OSDMap>> load_map(epoch_t e);

View File

@ -16,4 +16,6 @@ public:
virtual seastar::future<cached_map_t> get_map(epoch_t e) = 0;
/// get the latest map
virtual cached_map_t get_map() const = 0;
virtual ceph::signedspan get_mnow() const = 0;
virtual epoch_t get_up_epoch() const = 0;
};