return store.open_collection(coll_t::meta()).then([this] (auto ch) {
if (ch) {
// if we already have superblock, check if it matches
- meta_coll = make_unique<OSDMeta>(ch, &store);
+ meta_coll = make_unique<OSDMeta>(ch, store);
return meta_coll->load_superblock().then([this](OSDSuperblock&& sb) {
if (sb.cluster_fsid != superblock.cluster_fsid) {
logger().error("provided cluster fsid {} != superblock's {}",
superblock.cluster_fsid,
superblock.osd_fsid);
return store.create_new_collection(coll_t::meta()).then([this] (auto ch) {
- meta_coll = make_unique<OSDMeta>(ch , &store);
+ meta_coll = make_unique<OSDMeta>(ch, store);
ceph::os::Transaction t;
meta_coll->create(t);
meta_coll->store_superblock(t, superblock);
}).then([this] {
return store.open_collection(coll_t::meta());
}).then([this](auto ch) {
- meta_coll = make_unique<OSDMeta>(ch, &store);
+ meta_coll = make_unique<OSDMeta>(ch, store);
return meta_coll->load_superblock();
}).then([this](OSDSuperblock&& sb) {
superblock = std::move(sb);
{
logger().debug("{}: {}", __func__, pgid);
- return seastar::do_with(PGMeta(&store, pgid), [] (auto& pg_meta) {
+ return seastar::do_with(PGMeta(store, pgid), [](auto& pg_meta) {
return pg_meta.get_epoch();
}).then([this](epoch_t e) {
return get_map(e);
seastar::future<bufferlist> OSDMeta::load_map(epoch_t e)
{
- return store->read(coll,
- osdmap_oid(e), 0, 0,
- CEPH_OSD_OP_FLAG_FADVISE_WILLNEED).handle_error(
+ return store.read(coll,
+ osdmap_oid(e), 0, 0,
+ CEPH_OSD_OP_FLAG_FADVISE_WILLNEED).handle_error(
read_errorator::all_same_way([e] {
throw std::runtime_error(fmt::format("read gave enoent on {}",
osdmap_oid(e)));
seastar::future<OSDSuperblock> OSDMeta::load_superblock()
{
- return store->read(coll, superblock_oid(), 0, 0).safe_then(
+ return store.read(coll, superblock_oid(), 0, 0).safe_then(
[] (bufferlist&& bl) {
auto p = bl.cbegin();
OSDSuperblock superblock;
std::string,
OSDMeta::ec_profile_t>>
OSDMeta::load_final_pool_info(int64_t pool) {
- return store->read(coll, final_pool_info_oid(pool),
+ return store.read(coll, final_pool_info_oid(pool),
0, 0).safe_then([] (bufferlist&& bl) {
auto p = bl.cbegin();
pg_pool_t pi;
class OSDMeta {
template<typename T> using Ref = boost::intrusive_ptr<T>;
- crimson::os::FuturizedStore* store;
+ crimson::os::FuturizedStore& store;
Ref<crimson::os::FuturizedCollection> coll;
public:
OSDMeta(Ref<crimson::os::FuturizedCollection> coll,
- crimson::os::FuturizedStore* store)
+ crimson::os::FuturizedStore& store)
: store{store}, coll{coll}
{}
crimson::common::system_shutdown_exception());
}
- return seastar::do_with(PGMeta(store, pgid), [] (auto& pg_meta) {
+ return seastar::do_with(PGMeta(*store, pgid), [] (auto& pg_meta) {
return pg_meta.load();
}).then([this, store](auto&& ret) {
auto [pg_info, past_intervals] = std::move(ret);
// easily skip them
using crimson::os::FuturizedStore;
-PGMeta::PGMeta(FuturizedStore* store, spg_t pgid)
+PGMeta::PGMeta(FuturizedStore& store, spg_t pgid)
: store{store},
pgid{pgid}
{}
seastar::future<epoch_t> PGMeta::get_epoch()
{
- return store->open_collection(coll_t{pgid}).then([this](auto ch) {
- return store->omap_get_values(ch,
- pgid.make_pgmeta_oid(),
- {string{infover_key},
- string{epoch_key}}).safe_then(
+ return store.open_collection(coll_t{pgid}).then([this](auto ch) {
+ return store.omap_get_values(ch,
+ pgid.make_pgmeta_oid(),
+ {string{infover_key},
+ string{epoch_key}}).safe_then(
[](auto&& values) {
{
// sanity check
seastar::future<std::tuple<pg_info_t, PastIntervals>> PGMeta::load()
{
- return store->open_collection(coll_t{pgid}).then([this](auto ch) {
- return store->omap_get_values(ch,
- pgid.make_pgmeta_oid(),
- {string{infover_key},
- string{info_key},
- string{biginfo_key},
- string{fastinfo_key}});
+ return store.open_collection(coll_t{pgid}).then([this](auto ch) {
+ return store.omap_get_values(ch,
+ pgid.make_pgmeta_oid(),
+ {string{infover_key},
+ string{info_key},
+ string{biginfo_key},
+ string{fastinfo_key}});
}).safe_then([](auto&& values) {
{
// sanity check
/// PG related metadata
class PGMeta
{
- crimson::os::FuturizedStore* store;
+ crimson::os::FuturizedStore& store;
const spg_t pgid;
public:
- PGMeta(crimson::os::FuturizedStore *store, spg_t pgid);
+ PGMeta(crimson::os::FuturizedStore& store, spg_t pgid);
seastar::future<epoch_t> get_epoch();
seastar::future<std::tuple<pg_info_t, PastIntervals>> load();
};