Skip to content

Commit

Permalink
mutation: use fmtlib to print range_stombstone{_change,}
Browse files Browse the repository at this point in the history
prepare for removing `operator<<(std::ostream&, const range_tombstone&)` and
`operator<<(std::ostream& out, const range_tombstone_change&)`.

Refs scylladb#13245

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Mar 21, 2023
1 parent 755aea8 commit d146535
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mutation/mutation_fragment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ std::ostream& operator<<(std::ostream& os, const mutation_fragment::printer& p)
mf.visit(make_visitor(
[&] (const clustering_row& cr) { os << clustering_row::printer(p._schema, cr); },
[&] (const static_row& sr) { os << static_row::printer(p._schema, sr); },
[&] (const auto& what) -> void { os << what; }
[&] (const auto& what) -> void { fmt::print(os, "{}", what); }
));
os << "}";
return os;
Expand Down Expand Up @@ -371,7 +371,7 @@ std::ostream& operator<<(std::ostream& os, const mutation_fragment_v2::printer&
mf.visit(make_visitor(
[&] (const clustering_row& cr) { os << clustering_row::printer(p._schema, cr); },
[&] (const static_row& sr) { os << static_row::printer(p._schema, sr); },
[&] (const auto& what) -> void { os << what; }
[&] (const auto& what) -> void { fmt::print(os, "{}", what); }
));
os << "}";
return os;
Expand Down
3 changes: 2 additions & 1 deletion mutation/range_tombstone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ std::ostream& operator<<(std::ostream& out, const range_tombstone& rt) {
}

std::ostream& operator<<(std::ostream& out, const range_tombstone_change& rt) {
return out << "{range_tombstone_change: pos=" << rt.position() << ", " << rt.tombstone() << "}";
fmt::print(out, "{{range_tombstone_change: pos={}, {}}}", rt.position(), rt.tombstone());
return out;
}

std::optional<range_tombstone> range_tombstone::apply(const schema& s, range_tombstone&& src)
Expand Down
3 changes: 2 additions & 1 deletion mutation/range_tombstone_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ std::ostream& operator<<(std::ostream& out, const range_tombstone_list& list) {
}

std::ostream& operator<<(std::ostream& out, const range_tombstone_entry& rt) {
return out << rt._tombstone;
fmt::print(out, "{}", rt._tombstone);
return out;
}

bool range_tombstone_list::equal(const schema& s, const range_tombstone_list& other) const {
Expand Down
4 changes: 2 additions & 2 deletions test/boost/range_tombstone_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,11 @@ BOOST_AUTO_TEST_CASE(test_random_list_is_not_overlapped) {
if (!assert_valid(l)) {
std::cout << "For input:" << std::endl;
for (auto&& rt : input) {
std::cout << rt << std::endl;
fmt::print(std::cout, "{}\n", rt);
}
std::cout << "Produced:" << std::endl;
for (auto&& rt : l) {
std::cout << rt << std::endl;
fmt::print(std::cout, "{}\n", rt);
}
BOOST_REQUIRE(false);
}
Expand Down

0 comments on commit d146535

Please sign in to comment.