]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: use IsFullKey in *::estimate_insert() 47711/head
authorKefu Chai <tchaikov@gmail.com>
Sat, 20 Aug 2022 11:54:16 +0000 (19:54 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 20 Aug 2022 11:55:46 +0000 (19:55 +0800)
to fade out KeyT, so we can have more straightforward definitions.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/item_iterator_stage.h
src/crimson/os/seastore/onode_manager/staged-fltree/stages/node_stage.h
src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage.h
src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.cc
src/crimson/os/seastore/onode_manager/staged-fltree/stages/sub_items_stage.h

index f09c931a314bc2b99c030a558fe62c69dafdaf65..4f945b727c65d0d7a2e5b1cbb2c71d6d6faacf5c 100644 (file)
@@ -126,9 +126,9 @@ class item_iterator_t {
 
   static node_offset_t header_size() { return 0u; }
 
-  template <KeyT KT>
+  template <IsFullKey Key>
   static node_offset_t estimate_insert(
-      const full_key_t<KT>& key, const value_input_t&) {
+      const Key& key, const value_input_t&) {
     return ns_oid_view_t::estimate_size(key) + sizeof(node_offset_t);
   }
 
index 38a4ef5ccd7f04b89410b86923991ad434d867a2..b00539fd041ec9b7caf6c97eecf473040dc49a29 100644 (file)
@@ -133,9 +133,9 @@ class node_extent_t {
 
   static node_offset_t header_size() { return FieldType::HEADER_SIZE; }
 
-  template <KeyT KT>
+  template <IsFullKey Key>
   static node_offset_t estimate_insert(
-      const full_key_t<KT>& key, const value_input_t& value) {
+      const Key& key, const value_input_t& value) {
     auto size = FieldType::estimate_insert_one();
     if constexpr (FIELD_TYPE == field_type_t::N2) {
       size += ns_oid_view_t::estimate_size(key);
index 0ccc4ce74dd809e455d7c0041eb931a494bd7f11..0a8e87bc7e483650c0580d9eafb6744a3f863a19 100644 (file)
@@ -496,10 +496,10 @@ struct staged {
       return container_t::header_size();
     }
 
-    template <KeyT KT>
+    template <IsFullKey Key>
     static node_offset_t estimate_insert(
-        const full_key_t<KT>& key, const value_input_t& value) {
-      return container_t::template estimate_insert<KT>(key, value);
+        const Key& key, const value_input_t& value) {
+      return container_t::estimate_insert(key, value);
     }
 
    private:
@@ -837,10 +837,10 @@ struct staged {
       return container_t::header_size();
     }
 
-    template <KeyT KT>
-    static node_offset_t estimate_insert(const full_key_t<KT>& key,
+    template <IsFullKey Key>
+    static node_offset_t estimate_insert(const Key& key,
                                          const value_input_t& value) {
-      return container_t::template estimate_insert<KT>(key, value);
+      return container_t::estimate_insert(key, value);
     }
 
    private:
@@ -1137,9 +1137,9 @@ struct staged {
   static node_offset_t insert_size(const full_key_t<KT>& key,
                                    const value_input_t& value) {
     if constexpr (IS_BOTTOM) {
-      return iterator_t::template estimate_insert<KT>(key, value);
+      return iterator_t::estimate_insert(key, value);
     } else {
-      return iterator_t::template estimate_insert<KT>(key, value) +
+      return iterator_t::estimate_insert(key, value) +
              NXT_STAGE_T::iterator_t::header_size() +
              NXT_STAGE_T::template insert_size<KT>(key, value);
     }
index a9c50f8b2878834a31e28d2e37b207efabebe02f..2d37467a92b9366a14e47081914f3dc09b40c4cd 100644 (file)
@@ -14,7 +14,7 @@ const laddr_packed_t* internal_sub_items_t::insert_at(
     index_t index, node_offset_t size, const char* p_left_bound)
 {
   assert(index <= sub_items.keys());
-  assert(size == estimate_insert<KT>(key, value));
+  assert(size == estimate_insert(key, value));
   const char* p_shift_start = p_left_bound;
   const char* p_shift_end = reinterpret_cast<const char*>(
       sub_items.p_first_item + 1 - index);
@@ -91,7 +91,7 @@ const value_header_t* leaf_sub_items_t::insert_at(
     index_t index, node_offset_t size, const char* p_left_bound)
 {
   assert(index <= sub_items.keys());
-  assert(size == estimate_insert<KT>(key, value));
+  assert(size == estimate_insert(key, value));
   // a. [... item(index)] << size
   const char* p_shift_start = p_left_bound;
   const char* p_shift_end = sub_items.get_item_end(index);
index a17660ff89a0044de5149919cbe1aff2a66f6b8d..ed07dc763405ea8307ca7689e27419c98ddaea46 100644 (file)
@@ -103,9 +103,9 @@ class internal_sub_items_t {
 
   static node_offset_t header_size() { return 0u; }
 
-  template <KeyT KT>
+  template <IsFullKey Key>
   static node_offset_t estimate_insert(
-      const full_key_t<KT>&, const laddr_t&) {
+      const Key&, const laddr_t&) {
     return sizeof(internal_sub_item_t);
   }
 
@@ -283,9 +283,9 @@ class leaf_sub_items_t {
 
   static node_offset_t header_size() { return sizeof(num_keys_t); }
 
-  template <KeyT KT>
+  template <IsFullKey Key>
   static node_offset_t estimate_insert(
-      const full_key_t<KT>&, const value_config_t& value) {
+      const Key&, const value_config_t& value) {
     return value.allocation_size() + sizeof(snap_gen_t) + sizeof(node_offset_t);
   }