"MAX", "MAX", MAX_SNAP, MAX_GEN);
}
+// the valid key stored in tree should be in the range of (_MIN_OID, _MAX_OID)
+template <KeyT KT>
+bool is_valid_key(const full_key_t<KT>& key);
+
/**
* key_hobj_t
*
return os;
}
+ bool is_valid() const {
+ return is_valid_key<KeyT::HOBJ>(*this);
+ }
+
static key_hobj_t decode(ceph::bufferlist::const_iterator& delta) {
shard_t shard;
ceph::decode(shard, delta);
}
ghobject_t to_ghobj() const {
+ assert(is_valid_key<KeyT::VIEW>(*this));
return ghobject_t(
shard_id_t(shard()), pool(), crush(),
std::string(nspace()), std::string(oid()), snap(), gen());
return compare_full_key<KeyT::VIEW, KeyT::HOBJ>(*this, o);
}
+template <KeyT KT>
+bool is_valid_key(const full_key_t<KT>& key) {
+ return key.compare_to(key_hobj_t(ghobject_t())) == MatchKindCMP::GT &&
+ key.compare_to(key_hobj_t(ghobject_t::get_max())) == MatchKindCMP::LT;
+}
+
inline std::ostream& operator<<(std::ostream& os, const key_view_t& key) {
return key.dump(os);
}
return seastar::do_with(
full_key_t<KeyT::HOBJ>(obj),
[this, &t, vconf](auto& key) -> btree_future<std::pair<Cursor, bool>> {
+ ceph_assert(key.is_valid());
return get_root(t).safe_then([this, &t, &key, vconf](auto root) {
return root->insert(get_context(t), key, vconf);
}).safe_then([this](auto ret) {