}
if (type == "bluestore-kv") {
-#ifdef WITH_BLUESTORE
if (load_bluestore(path, read_only, to_repair) != 0)
exit(1);
-#else
- cerr << "bluestore not compiled in" << std::endl;
- exit(1);
-#endif
} else {
auto db_ptr = KeyValueDB::create(g_ceph_context, type, path);
if (!to_repair) {
}
}
-#ifdef WITH_BLUESTORE
int StoreTool::load_bluestore(const string& path, bool read_only, bool to_repair)
{
+#ifdef WITH_BLUESTORE
auto bluestore = new BlueStore(g_ceph_context, path);
KeyValueDB *db_ptr;
int r = bluestore->open_db_environment(&db_ptr, read_only, to_repair);
if (r < 0) {
return -EINVAL;
}
- db = decltype(db){db_ptr, Deleter(bluestore)};
+ db = decltype(db){db_ptr, Deleter((ObjectStore*)bluestore)};
return 0;
+#else
+ cerr << "bluestore not compiled in" << std::endl;
+ return -1;
+#endif // WITH_BLUESTORE
}
-#endif // WITH_BLUESTORE
uint32_t StoreTool::traverse(const string& prefix,
const bool do_crc,
#include "acconfig.h"
#include "include/buffer_fwd.h"
#include "kv/KeyValueDB.h"
-#ifdef WITH_BLUESTORE
-#include "os/bluestore/BlueStore.h"
-#endif
+#include "os/ObjectStore.h"
class KeyValueDB;
class StoreTool
{
-#ifdef WITH_BLUESTORE
struct Deleter {
- BlueStore *bluestore;
- Deleter()
- : bluestore(nullptr) {}
- Deleter(BlueStore *store)
- : bluestore(store) {}
+ ObjectStore *store = nullptr;
+ Deleter() {}
+ Deleter(ObjectStore *_store)
+ : store(_store) {}
void operator()(KeyValueDB *db) {
- if (bluestore) {
- bluestore->umount();
- delete bluestore;
+ if (store) {
+ store->umount();
+ delete store;
} else {
delete db;
}
}
};
std::unique_ptr<KeyValueDB, Deleter> db;
-#else
- std::unique_ptr<KeyValueDB> db;
-#endif
const std::string store_path;
int print_stats() const;
int build_size_histogram(const std::string& prefix) const;
-#ifdef WITH_BLUESTORE
private:
int load_bluestore(const std::string& path, bool read_only, bool need_open_db);
-#endif // WITH_BLUESTORE
};