From: Samuel Just Date: Mon, 19 Oct 2020 20:10:32 +0000 (-0700) Subject: crimson/common/fixed_kv_node_layout: add support for node dependent values X-Git-Tag: v16.1.0~807^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=88fd17948944121637defc100cc7e38945070238;p=ceph.git crimson/common/fixed_kv_node_layout: add support for node dependent values node_[un]resolve_vals can be used by implementations to transform vals during split and merge. Signed-off-by: Samuel Just --- diff --git a/src/crimson/common/fixed_kv_node_layout.h b/src/crimson/common/fixed_kv_node_layout.h index d284716da726..4c7cc2e76a43 100644 --- a/src/crimson/common/fixed_kv_node_layout.h +++ b/src/crimson/common/fixed_kv_node_layout.h @@ -325,6 +325,8 @@ public: FixedKVNodeLayout(char *buf) : buf(buf) {} + virtual ~FixedKVNodeLayout() = default; + const_iterator begin() const { return const_iterator( this, @@ -638,6 +640,17 @@ private: return layout.template Pointer<3>(buf); } + /** + * node_resolve/unresolve_vals + * + * If the representation for values depends in some way on the + * node in which they are located, users may implement + * resolve/unresolve to enable copy_from_foreign to handle that + * transition. + */ + virtual void node_resolve_vals(iterator from, iterator to) const {} + virtual void node_unresolve_vals(iterator from, iterator to) const {} + /** * copy_from_foreign * @@ -658,6 +671,8 @@ private: memcpy( tgt->get_key_ptr(), from_src->get_key_ptr(), to_src->get_key_ptr() - from_src->get_key_ptr()); + from_src->node->node_resolve_vals(tgt, tgt + (to_src - from_src)); + tgt->node->node_unresolve_vals(tgt, tgt + (to_src - from_src)); } /**