namespace crimson::os {
-std::unique_ptr<FuturizedStore>
+seastar::future<std::unique_ptr<FuturizedStore>>
FuturizedStore::create(const std::string& type,
const std::string& data,
const ConfigValues& values)
{
if (type == "cyanstore") {
- return std::make_unique<crimson::os::CyanStore>(data);
+ return seastar::make_ready_future<std::unique_ptr<FuturizedStore>>(std::make_unique<crimson::os::CyanStore>(data));
} else if (type == "seastore") {
- return crimson::os::seastore::make_seastore(data, values);
+ return seastar::make_ready_future<std::unique_ptr<FuturizedStore>>(crimson::os::seastore::make_seastore(data, values));
} else {
#ifdef WITH_BLUESTORE
// use AlienStore as a fallback. It adapts e.g. BlueStore.
- return std::make_unique<crimson::os::AlienStore>(
- type, data, values);
+ return seastar::make_ready_future<std::unique_ptr<FuturizedStore>>(std::make_unique<crimson::os::AlienStore>(
+ type, data, values));
#else
ceph_abort_msgf("unsupported objectstore type: %s", type.c_str());
return {};
};
using OmapIteratorRef = boost::intrusive_ptr<OmapIterator>;
- static std::unique_ptr<FuturizedStore> create(const std::string& type,
+ static seastar::future<std::unique_ptr<FuturizedStore>> create(const std::string& type,
const std::string& data,
const ConfigValues& values);
FuturizedStore() = default;
auto store = crimson::os::FuturizedStore::create(
local_conf().get_val<std::string>("osd_objectstore"),
local_conf().get_val<std::string>("osd_data"),
- local_conf().get_config_values());
+ local_conf().get_config_values()).get();
osd.start_single(whoami, nonce,
std::ref(*store),
seastar::future<> FSDriver::mkfs()
{
- init();
- assert(fs);
- return fs->start(
+ return init(
).then([this] {
+ assert(fs);
+ }).then([this] {
+ return fs->start();
+ }).then([this] {
uuid_d uuid;
uuid.generate_random();
return fs->mkfs(uuid).handle_error(
}).then([this] {
return fs->stop();
}).then([this] {
- init();
- return fs->start();
+ return init().then([this] {
+ return fs->start();
+ });
}).then([this] {
return fs->mount(
).handle_error(
return (
config.mkfs ? mkfs() : seastar::now()
).then([this] {
- init();
- return fs->start();
+ return init().then([this] {
+ return fs->start();
+ });
}).then([this] {
return fs->mount(
).handle_error(
});
}
-void FSDriver::init()
+seastar::future<> FSDriver::init()
{
fs.reset();
- fs = FuturizedStore::create(
+ return FuturizedStore::create(
config.get_fs_type(),
*config.path,
- crimson::common::local_conf().get_config_values());
+ crimson::common::local_conf().get_config_values()
+ ).then([this] (auto store_ptr) {
+ fs = std::move(store_ptr);
+ return seastar::now();
+ });
}
offset_mapping_t map_offset(off_t offset);
seastar::future<> mkfs();
- void init();
+ seastar::future<> init();
friend void populate_log(
ceph::os::Transaction &,