const std::optional<std::string> &last,
omap_list_config_t config = omap_list_config_t()) = 0;
+ /**
+ * remove key value mappings in a key range from omap tree
+ *
+ * @param omap_root_t &omap_root, omap btree root information
+ * @param Transaction &t, current transaction
+ * @param string &first, range start, must alive during the call
+ * @param string &last, range end, must alive during the call
+ */
+ using omap_rm_key_range_iertr = base_iertr;
+ using omap_rm_key_range_ret = omap_rm_key_range_iertr::future<>;
+ virtual omap_rm_key_range_ret omap_rm_key_range(
+ omap_root_t &omap_root,
+ Transaction &t,
+ const std::string &first,
+ const std::string &last,
+ omap_list_config_t config) = 0;
+
/**
* clear all omap tree key->value mapping
*
}
+BtreeOMapManager::omap_rm_key_range_ret
+BtreeOMapManager::omap_rm_key_range(
+ omap_root_t &omap_root,
+ Transaction &t,
+ const std::string &first,
+ const std::string &last,
+ omap_list_config_t config)
+{
+ LOG_PREFIX(BtreeOMapManager::omap_rm_key_range);
+ DEBUGT("{} ~ {}", t, first, last);
+ assert(first <= last);
+ return omap_list(
+ omap_root,
+ t,
+ first,
+ last,
+ config
+ ).si_then([this, &omap_root, &t](auto results) {
+ LOG_PREFIX(BtreeOMapManager::omap_rm_key_range);
+ auto &[complete, kvs] = results;
+ std::vector<std::string> keys;
+ for (const auto& [k, _] : kvs) {
+ keys.push_back(k);
+ }
+ DEBUGT("total {} keys to remove", t, keys.size());
+ return seastar::do_with(
+ std::move(keys),
+ [this, &omap_root, &t](auto& keys) {
+ return trans_intr::do_for_each(
+ keys.begin(),
+ keys.end(),
+ [this, &omap_root, &t](auto& key) {
+ return omap_rm_key(omap_root, t, key);
+ });
+ });
+ });
+}
+
BtreeOMapManager::omap_list_ret
BtreeOMapManager::omap_list(
const omap_root_t &omap_root,
Transaction &t,
const std::string &key) final;
+ omap_rm_key_range_ret omap_rm_key_range(
+ omap_root_t &omap_root,
+ Transaction &t,
+ const std::string &first,
+ const std::string &last,
+ omap_list_config_t config) final;
+
omap_list_ret omap_list(
const omap_root_t &omap_root,
Transaction &t,