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.
27 lines
544 B
C++
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
|