});
}
-auto AlienStore::omap_get_values(CollectionRef ch,
- const ghobject_t &oid,
- const std::optional<string> &start,
- uint32_t op_flags)
- -> read_errorator::future<std::tuple<bool, omap_values_t>>
-{
- logger().debug("{} with_start", __func__);
- assert(tp);
- return do_with_op_gate(omap_values_t{}, [=, this] (auto &values) {
- return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, this, &values] {
- auto c = static_cast<AlienCollection*>(ch.get());
- return store->omap_iterate(
- c->collection, oid,
- ObjectStore::omap_iter_seek_t{
- .seek_position = start.value_or(std::string{}),
- // FIXME: classical OSDs begins iteration from LOWER_BOUND
- // (or UPPER_BOUND if filter_prefix > start). However, these
- // bits are not implemented yet
- .seek_type = ObjectStore::omap_iter_seek_t::UPPER_BOUND
- },
- [&values]
- (std::string_view key, std::string_view value) mutable {
- values[std::string{key}].append(value);
- // FIXME: there is limit on number of entries yet
- return ObjectStore::omap_iter_ret_t::NEXT;
- });
- }).then([&values] (int r)
- -> read_errorator::future<std::tuple<bool, omap_values_t>> {
- if (r == -ENOENT) {
- return crimson::ct_error::enoent::make();
- } else if (r < 0){
- logger().error("omap_get_values(start): {}", r);
- return crimson::ct_error::input_output_error::make();
- } else {
- return read_errorator::make_ready_future<std::tuple<bool, omap_values_t>>(
- true, std::move(values));
- }
- });
- });
-}
-
AlienStore::read_errorator::future<ObjectStore::omap_iter_ret_t>
AlienStore::omap_iterate(CollectionRef ch,
const ghobject_t &oid,
const omap_keys_t& keys,
uint32_t op_flags = 0) final;
- /// Retrieves paged set of values > start (if present)
- read_errorator::future<std::tuple<bool, omap_values_t>> omap_get_values(
- CollectionRef c, ///< [in] collection
- const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start, ///< [in] start, empty for begin
- uint32_t op_flags = 0
- ) final; ///< @return <done, values> values.empty() iff done
-
seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>> list_objects(
CollectionRef c,
const ghobject_t& start,
return seastar::make_ready_future<omap_values_t>(std::move(values));
}
-auto CyanStore::Shard::omap_get_values(
- CollectionRef ch,
- const ghobject_t &oid,
- const std::optional<string> &start,
- uint32_t op_flags)
- -> CyanStore::Shard::read_errorator::future<std::tuple<bool, omap_values_t>>
-{
- auto c = static_cast<Collection*>(ch.get());
- logger().debug("{} {} {}", __func__, c->get_cid(), oid);
- auto o = c->get_object(oid);
- if (!o) {
- return crimson::ct_error::enoent::make();
- }
- omap_values_t values;
- for (auto i = start ? o->omap.upper_bound(*start) : o->omap.begin();
- i != o->omap.end();
- ++i) {
- values.insert(*i);
- }
- return seastar::make_ready_future<std::tuple<bool, omap_values_t>>(
- std::make_tuple(true, std::move(values)));
-}
-
auto CyanStore::Shard::omap_iterate(
CollectionRef ch,
const ghobject_t &oid,
const omap_keys_t& keys,
uint32_t op_flags = 0) final;
- read_errorator::future<std::tuple<bool, omap_values_t>> omap_get_values(
- CollectionRef c, ///< [in] collection
- const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start, ///< [in] start, empty for begin
- uint32_t op_flags = 0
- ) final;
-
read_errorator::future<ObjectStore::omap_iter_ret_t> omap_iterate(
CollectionRef c,
const ghobject_t &oid,
const omap_keys_t& keys,
uint32_t op_flags = 0) = 0;
- using omap_values_paged_t = std::tuple<bool, omap_values_t>;
- virtual read_errorator::future<omap_values_paged_t> omap_get_values(
- CollectionRef c, ///< [in] collection
- const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start, ///< [in] start, empty for begin
- uint32_t op_flags = 0
- ) = 0; ///< @return <done, values> values.empty() only if done
-
/**
* Iterate over object map with user-provided callable
*
case op_type_t::OMAP_GET_VALUES:
name = "omap_get_values";
break;
- case op_type_t::OMAP_GET_VALUES2:
- name = "omap_get_values2";
- break;
case op_type_t::OMAP_ITERATE:
name = "omap_iterate";
break;
{op_type_t::GET_ATTRS, sm::label_instance("latency", "GET_ATTRS")},
{op_type_t::STAT, sm::label_instance("latency", "STAT")},
{op_type_t::OMAP_GET_VALUES, sm::label_instance("latency", "OMAP_GET_VALUES")},
- {op_type_t::OMAP_GET_VALUES2, sm::label_instance("latency", "OMAP_GET_VALUES2")},
{op_type_t::OMAP_ITERATE, sm::label_instance("latency", "OMAP_ITERATE")},
};
});
}
-SeaStore::Shard::read_errorator::future<SeaStore::Shard::omap_values_paged_t>
-SeaStore::Shard::omap_get_values(
- CollectionRef ch,
- const ghobject_t &oid,
- const std::optional<std::string> &start,
- uint32_t op_flags)
-{
- ++(shard_stats.read_num);
- ++(shard_stats.pending_read_num);
-
- return repeat_with_onode<omap_values_paged_t>(
- ch,
- oid,
- Transaction::src_t::READ,
- "omap_get_values2",
- op_type_t::OMAP_GET_VALUES2,
- op_flags,
- [this, start](auto &t, auto &onode)
- {
- auto root = select_log_omap_root(onode);
- return omaptree_get_values(
- t, std::move(root), start);
- }).finally([this] {
- assert(shard_stats.pending_read_num);
- --(shard_stats.pending_read_num);
- });
-}
-
SeaStore::Shard::read_errorator::future<ObjectStore::omap_iter_ret_t>
SeaStore::Shard::omap_iterate(
CollectionRef ch,
GET_ATTRS,
STAT,
OMAP_GET_VALUES,
- OMAP_GET_VALUES2,
OMAP_ITERATE,
MAX
};
const omap_keys_t& keys,
uint32_t op_flags = 0) final;
- /// Retrieves paged set of values > start (if present)
- read_errorator::future<omap_values_paged_t> omap_get_values(
- CollectionRef c, ///< [in] collection
- const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start, ///< [in] start, empty for begin
- uint32_t op_flags = 0
- ) final; ///< @return <done, values> values.empty() iff done
-
read_errorator::future<ObjectStore::omap_iter_ret_t> omap_iterate(
CollectionRef c,
const ghobject_t &oid,
omap_root_t&& root,
const omap_keys_t& keys) const;
+ using omap_values_paged_t = std::tuple<bool, omap_values_t>;
base_iertr::future<omap_values_paged_t> omaptree_get_values(
Transaction& t,
omap_root_t&& root,