Files
scylladb/raft/raft.cc
Kamil Braun 44a1a8a8b0 raft: operator<<(ostream&, ...) implementation for server_address and configuration
Useful for debugging.

Had to make `configuration` constructor explicit. Otherwise the
`operator<<` implementation for `configuration` would implicitly convert
the `server_address` to `configuration` when trying to output it, causing
infinite recursion.

Removed implicit uses of the constructor.
2022-01-26 16:09:41 +01:00

27 lines
544 B
C++

/*
* Copyright (C) 2020-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "raft.hh"
#include "to_string.hh"
namespace raft {
seastar::logger logger("raft");
std::ostream& operator<<(std::ostream& os, const raft::server_address& addr) {
return os << addr.id;
}
std::ostream& operator<<(std::ostream& os, const raft::configuration& cfg) {
if (cfg.previous.empty()) {
return os << cfg.current;
}
return os << format("{}->{}", cfg.previous, cfg.current);
}
} // end of namespace raft