From 08b27491917f685d20a9f247292244f46d578b08 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 17 May 2013 11:35:46 +0100 Subject: [PATCH] Remove level from btree_details::damage --- .../data-structures/btree_damage_visitor.h | 17 ++++++----------- unit-tests/btree_damage_visitor_t.cc | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/persistent-data/data-structures/btree_damage_visitor.h b/persistent-data/data-structures/btree_damage_visitor.h index 3c8a9c7..08aaabe 100644 --- a/persistent-data/data-structures/btree_damage_visitor.h +++ b/persistent-data/data-structures/btree_damage_visitor.h @@ -12,28 +12,23 @@ namespace persistent_data { struct damage { typedef boost::shared_ptr ptr; - damage(unsigned level, - range lost_keys, + damage(range lost_keys, std::string const &desc) - : level_(level), - lost_keys_(lost_keys), + : lost_keys_(lost_keys), desc_(desc) { } - // Does _not_ compare the descriptions + // FIXME: Write a matcher instead. Does _not_ compare the descriptions bool operator ==(damage const &rhs) const { - return (level_ == rhs.level_) && - (lost_keys_ == rhs.lost_keys_); + return (lost_keys_ == rhs.lost_keys_); } - unsigned level_; range lost_keys_; std::string desc_; }; inline std::ostream &operator <<(std::ostream &out, damage const &d) { - out << "btree damage[level = " << d.level_ - << ", effected_keys = " << d.lost_keys_ + out << "btree damage[lost_keys = " << d.lost_keys_ << ", \"" << d.desc_ << "\"]"; return out; } @@ -387,7 +382,7 @@ namespace persistent_data { void issue_damage(range64 const &r) { // FIXME: we don't really know what level // the damage is coming from - damage d(0, r, build_damage_desc()); + damage d(r, build_damage_desc()); clear_damage_desc(); damage_visitor_.visit(d); } diff --git a/unit-tests/btree_damage_visitor_t.cc b/unit-tests/btree_damage_visitor_t.cc index 8187e5f..8ef6951 100644 --- a/unit-tests/btree_damage_visitor_t.cc +++ b/unit-tests/btree_damage_visitor_t.cc @@ -270,7 +270,7 @@ namespace { } void expect_damage(unsigned level, range keys) { - EXPECT_CALL(damage_visitor_, visit(Eq(damage(level, keys, "foo")))).Times(1); + EXPECT_CALL(damage_visitor_, visit(Eq(damage(keys, "foo")))).Times(1); } //--------------------------------