to fade out KeyT, so we can have more straightforward definitions.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
#define ITER_INST(NT) item_iterator_t<NT>
template <node_type_t NODE_TYPE>
-template <KeyT KT>
+template <IsFullKey Key>
memory_range_t ITER_T::insert_prefix(
- NodeExtentMutable& mut, const ITER_T& iter, const full_key_t<KT>& key,
+ NodeExtentMutable& mut, const ITER_T& iter, const Key& key,
bool is_end, node_offset_t size, const char* p_left_bound)
{
// 1. insert range
return {p_insert_front, p_insert};
}
-#define IP_TEMPLATE(NT, KT) \
- template memory_range_t ITER_INST(NT)::insert_prefix<KT>( \
- NodeExtentMutable&, const ITER_INST(NT)&, const full_key_t<KT>&, \
+#define IP_TEMPLATE(NT, Key) \
+ template memory_range_t ITER_INST(NT)::insert_prefix<Key>( \
+ NodeExtentMutable&, const ITER_INST(NT)&, const Key&, \
bool, node_offset_t, const char*)
-IP_TEMPLATE(node_type_t::LEAF, KeyT::VIEW);
-IP_TEMPLATE(node_type_t::INTERNAL, KeyT::VIEW);
-IP_TEMPLATE(node_type_t::LEAF, KeyT::HOBJ);
-IP_TEMPLATE(node_type_t::INTERNAL, KeyT::HOBJ);
+IP_TEMPLATE(node_type_t::LEAF, key_view_t);
+IP_TEMPLATE(node_type_t::INTERNAL, key_view_t);
+IP_TEMPLATE(node_type_t::LEAF, key_hobj_t);
+IP_TEMPLATE(node_type_t::INTERNAL, key_hobj_t);
template <node_type_t NODE_TYPE>
void ITER_T::update_size(
return ns_oid_view_t::estimate_size(key) + sizeof(node_offset_t);
}
- template <KeyT KT>
+ template <IsFullKey Key>
static memory_range_t insert_prefix(
NodeExtentMutable& mut, const item_iterator_t<NODE_TYPE>& iter,
- const full_key_t<KT>& key, bool is_end,
+ const Key& key, bool is_end,
node_offset_t size, const char* p_left_bound);
static void update_size(
}
template <typename FieldType, node_type_t NODE_TYPE>
-template <KeyT KT>
+template <IsFullKey Key>
memory_range_t NODE_T::insert_prefix_at(
- NodeExtentMutable& mut, const node_extent_t& node, const full_key_t<KT>& key,
+ NodeExtentMutable& mut, const node_extent_t& node, const Key& key,
index_t index, node_offset_t size, const char* p_left_bound)
{
assert(mut.get_length() == node.node_size);
ceph_abort("impossible");
}
}
-#define IPA_TEMPLATE(FT, NT, KT) \
- template memory_range_t NODE_INST(FT, NT)::insert_prefix_at<KT>( \
- NodeExtentMutable&, const node_extent_t&, const full_key_t<KT>&, \
+#define IPA_TEMPLATE(FT, NT, Key) \
+ template memory_range_t NODE_INST(FT, NT)::insert_prefix_at<Key>( \
+ NodeExtentMutable&, const node_extent_t&, const Key&, \
index_t, node_offset_t, const char*)
-IPA_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::VIEW);
-IPA_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, KeyT::HOBJ);
-IPA_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, KeyT::HOBJ);
-IPA_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, KeyT::HOBJ);
-IPA_TEMPLATE(node_fields_0_t, node_type_t::LEAF, KeyT::HOBJ);
-IPA_TEMPLATE(node_fields_1_t, node_type_t::LEAF, KeyT::HOBJ);
-IPA_TEMPLATE(node_fields_2_t, node_type_t::LEAF, KeyT::HOBJ);
+IPA_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, key_view_t);
+IPA_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, key_view_t);
+IPA_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, key_view_t);
+IPA_TEMPLATE(node_fields_0_t, node_type_t::LEAF, key_view_t);
+IPA_TEMPLATE(node_fields_1_t, node_type_t::LEAF, key_view_t);
+IPA_TEMPLATE(node_fields_2_t, node_type_t::LEAF, key_view_t);
+IPA_TEMPLATE(node_fields_0_t, node_type_t::INTERNAL, key_hobj_t);
+IPA_TEMPLATE(node_fields_1_t, node_type_t::INTERNAL, key_hobj_t);
+IPA_TEMPLATE(node_fields_2_t, node_type_t::INTERNAL, key_hobj_t);
+IPA_TEMPLATE(node_fields_0_t, node_type_t::LEAF, key_hobj_t);
+IPA_TEMPLATE(node_fields_1_t, node_type_t::LEAF, key_hobj_t);
+IPA_TEMPLATE(node_fields_2_t, node_type_t::LEAF, key_hobj_t);
template <typename FieldType, node_type_t NODE_TYPE>
void NODE_T::update_size_at(
return size;
}
- template <KeyT KT>
+ template <IsFullKey Key>
static const value_t* insert_at(
NodeExtentMutable& mut, const node_extent_t&,
- const full_key_t<KT>& key, const value_input_t& value,
+ const Key& key, const value_input_t& value,
index_t index, node_offset_t size, const char* p_left_bound) {
if constexpr (FIELD_TYPE == field_type_t::N3) {
ceph_abort("not implemented");
}
}
- template <KeyT KT>
+ template <IsFullKey Key>
static memory_range_t insert_prefix_at(
NodeExtentMutable&, const node_extent_t&,
- const full_key_t<KT>& key,
+ const Key& key,
index_t index, node_offset_t size, const char* p_left_bound);
static void update_size_at(
const value_input_t& value,
node_offset_t insert_size,
const char* p_left_bound) {
- return container_t::template insert_at<KT>(
+ return container_t::insert_at(
mut, container, key, value, _index, insert_size, p_left_bound);
}
- template <KeyT KT, typename T = memory_range_t>
+ template <IsFullKey Key, typename T = memory_range_t>
std::enable_if_t<!IS_BOTTOM, T> insert_prefix(
- NodeExtentMutable& mut, const full_key_t<KT>& key,
+ NodeExtentMutable& mut, const Key& key,
node_offset_t size, const char* p_left_bound) {
- return container_t::template insert_prefix_at<KT>(
+ return container_t::insert_prefix_at(
mut, container, key, _index, size, p_left_bound);
}
return MatchKindBS::NE;
}
- template <KeyT KT>
+ template <IsFullKey Key>
memory_range_t insert_prefix(
- NodeExtentMutable& mut, const full_key_t<KT>& key,
+ NodeExtentMutable& mut, const Key& key,
node_offset_t size, const char* p_left_bound) {
- return container_t::template insert_prefix<KT>(
+ return container_t::insert_prefix(
mut, container, key, is_end(), size, p_left_bound);
}
return iter.template insert<KT>(
mut, key, value, _insert_size, p_left_bound);
} else {
- auto range = iter.template insert_prefix<KT>(
+ auto range = iter.insert_prefix(
mut, key, _insert_size, p_left_bound);
return NXT_STAGE_T::template insert_new<KT>(mut, range, key, value);
}
ceph_abort("impossible path");
}
if constexpr (IS_BOTTOM) {
- return container_t::template insert_at<KT>(
+ return container_t::insert_at(
mut, container, key, value, 0, _insert_size, p_left_bound);
} else {
- auto range = container_t::template insert_prefix_at<KT>(
+ auto range = container_t::template insert_prefix_at(
mut, container, key, 0, _insert_size, p_left_bound);
return NXT_STAGE_T::template insert_new<KT>(mut, range, key, value);
}
namespace crimson::os::seastore::onode {
-template <KeyT KT>
+template <IsFullKey Key>
const laddr_packed_t* internal_sub_items_t::insert_at(
NodeExtentMutable& mut, const internal_sub_items_t& sub_items,
- const full_key_t<KT>& key, const laddr_t& value,
+ const Key& key, const laddr_t& value,
index_t index, node_offset_t size, const char* p_left_bound)
{
assert(index <= sub_items.keys());
mut.copy_in_absolute(p_insert, item);
return &reinterpret_cast<internal_sub_item_t*>(p_insert)->value;
}
-#define IA_TEMPLATE(KT) \
- template const laddr_packed_t* internal_sub_items_t::insert_at<KT>( \
- NodeExtentMutable&, const internal_sub_items_t&, const full_key_t<KT>&, \
+#define IA_TEMPLATE(Key) \
+ template const laddr_packed_t* internal_sub_items_t::insert_at<Key>( \
+ NodeExtentMutable&, const internal_sub_items_t&, const Key&, \
const laddr_t&, index_t, node_offset_t, const char*)
-IA_TEMPLATE(KeyT::VIEW);
-IA_TEMPLATE(KeyT::HOBJ);
+IA_TEMPLATE(key_view_t);
+IA_TEMPLATE(key_hobj_t);
node_offset_t internal_sub_items_t::trim_until(
NodeExtentMutable& mut, internal_sub_items_t& items, index_t index)
p_value = &reinterpret_cast<internal_sub_item_t*>(p_append)->value;
}
-template <KeyT KT>
+template <IsFullKey Key>
const value_header_t* leaf_sub_items_t::insert_at(
NodeExtentMutable& mut, const leaf_sub_items_t& sub_items,
- const full_key_t<KT>& key, const value_config_t& value,
+ const Key& key, const value_config_t& value,
index_t index, node_offset_t size, const char* p_left_bound)
{
assert(index <= sub_items.keys());
return p_value;
}
-template const value_header_t* leaf_sub_items_t::insert_at<KeyT::HOBJ>(
- NodeExtentMutable&, const leaf_sub_items_t&, const full_key_t<KeyT::HOBJ>&,
+template const value_header_t* leaf_sub_items_t::insert_at<key_hobj_t>(
+ NodeExtentMutable&, const leaf_sub_items_t&, const key_hobj_t&,
const value_config_t&, index_t, node_offset_t, const char*);
node_offset_t leaf_sub_items_t::trim_until(
return sizeof(internal_sub_item_t);
}
- template <KeyT KT>
+ template <IsFullKey Key>
static const laddr_packed_t* insert_at(
NodeExtentMutable&, const internal_sub_items_t&,
- const full_key_t<KT>&, const laddr_t&,
+ const Key&, const laddr_t&,
index_t index, node_offset_t size, const char* p_left_bound);
static node_offset_t trim_until(NodeExtentMutable&, internal_sub_items_t&, index_t);
return value.allocation_size() + sizeof(snap_gen_t) + sizeof(node_offset_t);
}
- template <KeyT KT>
+ template <IsFullKey Key>
static const value_header_t* insert_at(
NodeExtentMutable&, const leaf_sub_items_t&,
- const full_key_t<KT>&, const value_config_t&,
+ const Key&, const value_config_t&,
index_t index, node_offset_t size, const char* p_left_bound);
static node_offset_t trim_until(NodeExtentMutable&, leaf_sub_items_t&, index_t index);