// pool was deleted; grab final pg_pool_t off disk.
return meta_coll->load_final_pool_info(pgid.pool());
}
- }).then([this](pg_pool_t&& pool, string&& name, ec_profile_t&& ec_profile) {
- Ref<PG> pg{new PG{std::move(pool),
+ }).then([pgid, this](pg_pool_t&& pool,
+ string&& name,
+ ec_profile_t&& ec_profile) {
+ Ref<PG> pg{new PG{pgid,
+ pg_shard_t{whoami, pgid.shard},
+ std::move(pool),
std::move(name),
- std::move(ec_profile)}};
+ std::move(ec_profile),
+ osdmap,
+ cluster_msgr}};
return seastar::make_ready_future<Ref<PG>>(std::move(pg));
});
}
#include "pg.h"
-PG::PG(pg_pool_t&& pool, std::string&& name, ec_profile_t&& ec_profile)
+#include "osd/OSDMap.h"
+
+
+PG::PG(spg_t pgid,
+ pg_shard_t pg_shard,
+ pg_pool_t&& pool,
+ std::string&& name,
+ ec_profile_t&& ec_profile,
+ cached_map_t osdmap,
+ ceph::net::Messenger* msgr)
+ : pgid{pgid},
+ whoami{pg_shard},
+ pool{std::move(pool)},
+ osdmap{osdmap},
+ msgr{msgr}
{
// TODO
}
+
+epoch_t PG::get_osdmap_epoch() const
+{
+ return osdmap->get_epoch();
+}
+
+pg_shard_t PG::get_whoami() const
+{
+ return whoami;
+}
#include <boost/intrusive_ptr.hpp>
#include <boost/smart_ptr/intrusive_ref_counter.hpp>
+#include <boost/smart_ptr/local_shared_ptr.hpp>
#include <seastar/core/future.hh>
#include "osd/osd_types.h"
template<typename T> using Ref = boost::intrusive_ptr<T>;
+class OSDMap;
+
+namespace ceph::net {
+ class Messenger;
+}
class PG : public boost::intrusive_ref_counter<
PG,
boost::thread_unsafe_counter>
{
using ec_profile_t = std::map<std::string,std::string>;
+ using cached_map_t = boost::local_shared_ptr<OSDMap>;
+
public:
- PG(pg_pool_t&& pool, std::string&& name, ec_profile_t&& ec_profile);
+ PG(spg_t pgid,
+ pg_shard_t pg_shard,
+ pg_pool_t&& pool,
+ std::string&& name,
+ ec_profile_t&& ec_profile,
+ cached_map_t osdmap,
+ ceph::net::Messenger* msgr);
+
+ epoch_t get_osdmap_epoch() const;
+ pg_shard_t get_whoami() const;
+
+private:
+ const spg_t pgid;
+ pg_shard_t whoami;
+ pg_pool_t pool;
+ cached_map_t osdmap;
+ ceph::net::Messenger* msgr = nullptr;
};