return seastar::now();
}
+seastar::lw_shared_ptr<OSDMap> OSD::get_map() const
+{
+ return osdmap;
+}
+
seastar::future<seastar::lw_shared_ptr<OSDMap>> OSD::get_map(epoch_t e)
{
// TODO: use LRU cache for managing osdmap, fallback to disk if we have to
#include "crimson/mon/MonClient.h"
#include "crimson/net/Dispatcher.h"
#include "crimson/osd/chained_dispatchers.h"
+#include "crimson/osd/osdmap_service.h"
#include "crimson/osd/state.h"
#include "osd/OSDMap.h"
template<typename T> using Ref = boost::intrusive_ptr<T>;
-class OSD : public ceph::net::Dispatcher {
+class OSD : public ceph::net::Dispatcher,
+ private OSDMapService {
seastar::gate gate;
seastar::timer<seastar::lowres_clock> beacon_timer;
const int whoami;
public:
OSD(int id, uint32_t nonce);
- ~OSD();
+ ~OSD() override;
seastar::future<> mkfs(uuid_d fsid);
seastar::future<Ref<PG>> load_pg(spg_t pgid);
seastar::future<> load_pgs();
- seastar::future<seastar::lw_shared_ptr<OSDMap>> get_map(epoch_t e);
+ // OSDMapService methods
+ seastar::future<seastar::lw_shared_ptr<OSDMap>> get_map(epoch_t e) override;
+ seastar::lw_shared_ptr<OSDMap> get_map() const override;
+
seastar::future<bufferlist> load_map_bl(epoch_t e);
void store_map_bl(ceph::os::Transaction& t,
epoch_t e, bufferlist&& bl);
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <seastar/core/shared_ptr.hh>
+
+#include "include/types.h"
+
+class OSDMap;
+
+class OSDMapService {
+public:
+ virtual ~OSDMapService() = default;
+ virtual seastar::future<seastar::lw_shared_ptr<OSDMap>>
+ get_map(epoch_t e) = 0;
+ /// get the latest map
+ virtual seastar::lw_shared_ptr<OSDMap> get_map() const = 0;
+};