locator: topology: Add printer
This commit is contained in:
@@ -509,6 +509,18 @@ void topology::for_each_node(std::function<void(const node*)> func) const {
|
||||
|
||||
namespace std {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const locator::topology& t) {
|
||||
out << "{this_host_id: " << t._cfg.this_host_id
|
||||
<< ", this_endpoint: " << t._cfg.this_endpoint
|
||||
<< ", dc: " << t._cfg.local_dc_rack.dc
|
||||
<< ", rack: " << t._cfg.local_dc_rack.rack
|
||||
<< ", nodes:\n";
|
||||
for (auto&& node : t._nodes) {
|
||||
out << " " << locator::topology::debug_format(&*node) << "\n";
|
||||
}
|
||||
return out << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const locator::node& node) {
|
||||
fmt::print(out, "{}", node);
|
||||
return out;
|
||||
|
||||
@@ -25,8 +25,14 @@
|
||||
using namespace seastar;
|
||||
|
||||
namespace locator {
|
||||
|
||||
class topology;
|
||||
}
|
||||
|
||||
namespace std {
|
||||
std::ostream& operator<<(std::ostream& out, const locator::topology&);
|
||||
}
|
||||
|
||||
namespace locator {
|
||||
|
||||
class node;
|
||||
using node_holder = std::unique_ptr<node>;
|
||||
@@ -315,6 +321,8 @@ private:
|
||||
friend class token_metadata_impl;
|
||||
public:
|
||||
void test_compare_endpoints(const inet_address& address, const inet_address& a1, const inet_address& a2) const;
|
||||
|
||||
friend std::ostream& std::operator<<(std::ostream& out, const topology&);
|
||||
};
|
||||
|
||||
} // namespace locator
|
||||
|
||||
Reference in New Issue
Block a user