BtreeOMapManager::omap_get_value(
const omap_root_t &omap_root,
Transaction &t,
- const std::string &key)
+ std::string key)
{
LOG_PREFIX(BtreeOMapManager::omap_get_value);
DEBUGT("key={}", t, key);
- return get_omap_root(
- get_omap_context(t, omap_root),
- omap_root
- ).si_then([this, &t, &key, &omap_root](auto&& extent) {
- return extent->get_value(
- get_omap_context(t, omap_root), key);
- }).si_then([](auto &&e) {
- return omap_get_value_ret(
- interruptible::ready_future_marker{},
- std::move(e));
- });
+ auto extent = co_await get_omap_root(get_omap_context(t, omap_root), omap_root);
+ co_return co_await extent->get_value(get_omap_context(t, omap_root), key);
}
BtreeOMapManager::omap_set_keys_ret
BtreeOMapManager::omap_set_keys(
omap_root_t &omap_root,
Transaction &t,
- std::map<std::string, ceph::bufferlist>&& keys)
+ std::map<std::string, ceph::bufferlist> keys)
{
- return seastar::do_with(std::move(keys), [&, this](auto& keys) {
- return trans_intr::do_for_each(
- keys.begin(),
- keys.end(),
- [&, this](auto &p) {
- return omap_set_key(omap_root, t, p.first, p.second);
- });
- });
+ LOG_PREFIX(BtreeOMapManager::omap_set_keys);
+ for (auto &p: keys) {
+ DEBUGT("set key={}", t, p.first);
+ co_await omap_set_key(omap_root, t, p.first, p.second);
+ }
}
BtreeOMapManager::omap_set_key_ret
BtreeOMapManager::omap_set_key(
omap_root_t &omap_root,
Transaction &t,
- const std::string &key,
- const ceph::bufferlist &value)
+ std::string key,
+ ceph::bufferlist value)
{
LOG_PREFIX(BtreeOMapManager::omap_set_key);
DEBUGT("{} -> 0x{:x} value", t, key, value.length());
- // #FIXME: heap buffer overflow during logging if value is long (e.g. 1020B)
+ // #FIXME: heap buffer overflow during logging if value is long (e.g. 1020B)
// https://tracker.ceph.com/issues/71524
// DEBUGT("{} -> {}", t, key, value);
- return get_omap_root(
- get_omap_context(t, omap_root),
- omap_root
- ).si_then([this, &t, &key, &value, &omap_root](auto root) {
- return root->insert(get_omap_context(
- t, omap_root), key, value);
- }).si_then([this, &omap_root, &t](auto mresult) -> omap_set_key_ret {
- if (mresult.status == mutation_status_t::SUCCESS)
- return seastar::now();
- else if (mresult.status == mutation_status_t::WAS_SPLIT)
- return handle_root_split(
- get_omap_context(t, omap_root), omap_root, mresult);
- else
- return seastar::now();
- });
+ auto root = co_await get_omap_root(get_omap_context(t, omap_root), omap_root);
+ auto mresult = co_await root->insert(get_omap_context(t, omap_root), key, value);
+ if (mresult.status == mutation_status_t::WAS_SPLIT) {
+ co_await handle_root_split(get_omap_context(t, omap_root), omap_root, mresult);
+ }
}
BtreeOMapManager::omap_rm_key_ret
BtreeOMapManager::omap_rm_key(
omap_root_t &omap_root,
Transaction &t,
- const std::string &key)
+ std::string key)
{
LOG_PREFIX(BtreeOMapManager::omap_rm_key);
DEBUGT("{}", t, key);
- return get_omap_root(
- get_omap_context(t, omap_root),
- omap_root
- ).si_then([this, &t, &key, &omap_root](auto root) {
- return root->rm_key(get_omap_context(t, omap_root), key);
- }).si_then([this, &omap_root, &t](auto mresult) -> omap_rm_key_ret {
- if (mresult.status == mutation_status_t::SUCCESS) {
- return seastar::now();
- } else if (mresult.status == mutation_status_t::WAS_SPLIT) {
- return handle_root_split(
- get_omap_context(t, omap_root), omap_root, mresult);
- } else if (mresult.status == mutation_status_t::NEED_MERGE) {
- auto root = *(mresult.need_merge);
- if (root->get_node_size() == 1 && omap_root.depth != 1) {
- return handle_root_merge(
- get_omap_context(t, omap_root), omap_root, mresult);
- } else {
- return seastar::now();
- }
- } else {
- return seastar::now();
+ auto root = co_await get_omap_root(get_omap_context(t, omap_root), omap_root);
+ auto mresult = co_await root->rm_key(get_omap_context(t, omap_root), key);
+
+ if (mresult.status == mutation_status_t::WAS_SPLIT) {
+ co_await handle_root_split(get_omap_context(t, omap_root), omap_root, mresult);
+ } else if (mresult.status == mutation_status_t::NEED_MERGE) {
+ auto root = *(mresult.need_merge);
+ if (root->get_node_size() == 1 && omap_root.depth != 1) {
+ co_await handle_root_merge(get_omap_context(t, omap_root), omap_root, mresult);
}
- });
+ }
}
BtreeOMapManager::omap_rm_keys_ret
BtreeOMapManager::omap_rm_keys(
omap_root_t &omap_root,
Transaction &t,
- std::set<std::string>& keys)
+ std::set<std::string> keys)
{
+ LOG_PREFIX(BtreeOMapManager::omap_rm_keys);
auto type = omap_root.get_type();
- return trans_intr::do_for_each(
- keys.begin(),
- keys.end(),
- [&t, &omap_root, type, this](auto &p)
- {
- LOG_PREFIX(BtreeOMapManager::omap_rm_keys);
+ for (auto &p: keys) {
DEBUGT("{} remove key={} ...", t, type, p);
- return omap_rm_key(omap_root, t, p);
- });
+ co_await omap_rm_key(omap_root, t, p);
+ }
}
BtreeOMapManager::omap_rm_key_range_ret
LogManager::omap_set_keys_ret
LogManager::omap_set_keys(
omap_root_t &log_root,
- Transaction &t, std::map<std::string, ceph::bufferlist>&& _kvs)
+ Transaction &t, std::map<std::string, ceph::bufferlist> kvs)
{
LOG_PREFIX(LogManager::omap_set_keys);
- DEBUGT("enter kv size {}", t, _kvs.size());
+ DEBUGT("enter kv size {}", t, kvs.size());
assert(log_root.get_type() == omap_type_t::LOG);
- auto kvs = std::move(_kvs);
auto ext = co_await log_load_extent<LogNode>(
t, log_root.addr, BEGIN_KEY, END_KEY);
ceph_assert(ext);
LogManager::omap_set_key(
omap_root_t &log_root,
Transaction &t,
- const std::string &key, const ceph::bufferlist &value)
+ std::string key, ceph::bufferlist value)
{
LOG_PREFIX(LogManager::omap_set_key);
DEBUGT("enter k={}", t, key);
LogManager::omap_get_value_ret
LogManager::omap_get_value(
- const omap_root_t &log_root, Transaction &t, const std::string &key)
+ const omap_root_t &log_root, Transaction &t, std::string key)
{
LOG_PREFIX(LogManager::omap_get_value);
DEBUGT("key={}", t, key);
LogManager::omap_rm_key(
omap_root_t &log_root,
Transaction &t,
- const std::string &key)
+ std::string key)
{
LOG_PREFIX(LogManager::omap_rm_key);
DEBUGT("key={}", t, key);
LogManager::omap_rm_keys(
omap_root_t& log_root,
Transaction& t,
- std::set<std::string>& keys)
+ std::set<std::string> keys)
{
LOG_PREFIX(LogManager::omap_rm_keys);
DEBUGT("key size={}", t, keys.size());