return out;
}
+std::string entity_addr_t::fmt_print() const
+{
+ if (type == entity_addr_t::TYPE_NONE) {
+ return "-";
+ }
+ std::ostringstream out; //< \todo use fmt::format
+ out << get_sockaddr();
+
+ if (type == entity_addr_t::TYPE_ANY) {
+ return fmt::format("{}/{}", out.str(), nonce);
+ } else {
+ return fmt::format("{}:{}/{}", get_type_name(type), out.str(), nonce);
+ }
+}
+
std::ostream& operator<<(std::ostream& out, const sockaddr *psa)
{
char buf[NI_MAXHOST] = { 0 };
#include <sstream>
#include <netinet/in.h>
-#include <fmt/format.h>
+#include "common/fmt_common.h"
#if FMT_VERSION >= 90000
#include <fmt/ostream.h>
#endif
}
void dump(ceph::Formatter *f) const;
+ std::string fmt_print() const; ///< used by the default fmt formatter
static void generate_test_instances(std::list<entity_addr_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(entity_addr_t)
std::ostream& operator<<(std::ostream& out, const entity_addr_t &addr);
-#if FMT_VERSION >= 90000
-template <> struct fmt::formatter<entity_addr_t> : fmt::ostream_formatter {};
-#endif
inline bool operator==(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) == 0; }
inline bool operator!=(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) != 0; }
f->close_section();
}
+std::string watch_info_t::fmt_print() const
+{
+ return fmt::format(
+ "watch(cookie {} {}s {})", cookie, timeout_seconds, addr);
+}
+
+
void watch_info_t::generate_test_instances(list<watch_info_t*>& o)
{
o.push_back(new watch_info_t);
/// get space accounted to clone
uint64_t get_clone_bytes(snapid_t clone) const;
-
+
void encode(ceph::buffer::list& bl) const;
void decode(ceph::buffer::list::const_iterator& bl);
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(std::list<SnapSet*>& o);
+ static void generate_test_instances(std::list<SnapSet*>& o);
SnapContext get_ssc_as_of(snapid_t as_of) const {
SnapContext out;
void encode(ceph::buffer::list& bl, uint64_t features) const;
void decode(ceph::buffer::list::const_iterator& bl);
void dump(ceph::Formatter *f) const;
+ std::string fmt_print() const;
static void generate_test_instances(std::list<watch_info_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(watch_info_t)
}
static inline std::ostream& operator<<(std::ostream& out, const watch_info_t& w) {
- return out << "watch(cookie " << w.cookie << " " << w.timeout_seconds << "s"
- << " " << w.addr << ")";
+ return out << w.fmt_print();
}
struct notify_info_t {
};
#if FMT_VERSION >= 90000
-template <> struct fmt::formatter<watch_info_t> : fmt::ostream_formatter {};
template <bool TrackChanges> struct fmt::formatter<pg_missing_set<TrackChanges>> : fmt::ostream_formatter {};
#endif