From: Yingxin Cheng Date: Fri, 1 Jul 2022 08:26:44 +0000 (+0800) Subject: crimson/onode-staged-tree: expose compare method for ghobject_t X-Git-Tag: v18.0.0~594^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=897aa9da93f3f2b58442ba0558d70c59d2abd07e;p=ceph.git crimson/onode-staged-tree: expose compare method for ghobject_t Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/tree.h b/src/crimson/os/seastore/onode_manager/staged-fltree/tree.h index 8c13f4fe1bc4..bffc9b8945ca 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/tree.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/tree.h @@ -47,6 +47,15 @@ class Btree { Btree& operator=(const Btree&) = delete; Btree& operator=(Btree&&) = delete; + /** + * compare + * + * This defines the internal order of Btree from ghobject_t perspective. + */ + static int compare(const ghobject_t &l, const ghobject_t &r) { + return static_cast(key_hobj_t(l).compare_to(key_hobj_t(r))); + } + eagain_ifuture<> mkfs(Transaction& t) { return Node::mkfs(get_context(t), *root_tracker); } @@ -218,6 +227,13 @@ class Btree { ); } + /** + * lower_bound + * + * Returns a Cursor pointing to the element that is equal to the key, or the + * first element larger than the key, or the end Cursor if that element + * doesn't exist. + */ eagain_ifuture lower_bound(Transaction& t, const ghobject_t& obj) { return seastar::do_with( full_key_t(obj),