From 897aa9da93f3f2b58442ba0558d70c59d2abd07e Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 1 Jul 2022 16:26:44 +0800 Subject: [PATCH] crimson/onode-staged-tree: expose compare method for ghobject_t Signed-off-by: Yingxin Cheng --- .../seastore/onode_manager/staged-fltree/tree.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 8c13f4fe1bc45..bffc9b8945ca1 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), -- 2.39.5