return (rank == MDS_RANK_NONE);
}
+ void print(std::ostream& out) const {
+ out << fscid << ":" << rank;
+ }
+
fs_cluster_id_t fscid = FS_CLUSTER_ID_NONE;
mds_rank_t rank = MDS_RANK_NONE;
};
-inline std::ostream& operator<<(std::ostream& out, const mds_role_t& role) {
- return out << role.fscid << ":" << role.rank;
-}
// CAPS
inline std::string gcap_string(int cap)
void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<old_rstat_t*>& ls);
+ void print(std::ostream& out) const {
+ out << "old_rstat(first " << first << " " << rstat << " " << accounted_rstat << ")";
+ }
+
snapid_t first;
nest_info_t rstat, accounted_rstat;
};
WRITE_CLASS_ENCODER(old_rstat_t)
-inline std::ostream& operator<<(std::ostream& out, const old_rstat_t& o) {
- return out << "old_rstat(first " << o.first << " " << o.rstat << " " << o.accounted_rstat << ")";
-}
-
class feature_bitset_t {
public:
typedef uint64_t block_type;
};
WRITE_CLASS_ENCODER(feature_bitset_t)
-inline std::ostream& operator<<(std::ostream& out, const feature_bitset_t& s) {
- s.print(out);
- return out;
-}
-
struct metric_spec_t {
metric_spec_t() {}
metric_spec_t(const metric_spec_t& other) :
};
WRITE_CLASS_ENCODER(metric_spec_t)
-inline std::ostream& operator<<(std::ostream& out, const metric_spec_t& mst) {
- mst.print(out);
- return out;
-}
-
/*
* client_metadata_t
*/
dentry_key_t(snapid_t s, std::string_view n, __u32 h=0) :
snapid(s), name(n), hash(h) {}
+ void print(std::ostream& out) const {
+ out << "(" << name << "," << snapid << ")";
+ }
+
bool is_valid() { return name.length() || snapid; }
// encode into something that can be decoded as a string.
__u32 hash = 0;
};
-inline std::ostream& operator<<(std::ostream& out, const dentry_key_t &k)
-{
- return out << "(" << k.name << "," << k.snapid << ")";
-}
-
inline bool operator<(const dentry_key_t& k1, const dentry_key_t& k2)
{
/*
string_snap_t() {}
string_snap_t(std::string_view n, snapid_t s) : name(n), snapid(s) {}
+ void print(std::ostream& out) const {
+ out << "(" << name << "," << snapid << ")";
+ }
+
int compare(const string_snap_t& r) const {
int ret = name.compare(r.name);
if (ret)
return c < 0 || (c == 0 && l.snapid < r.snapid);
}
-inline std::ostream& operator<<(std::ostream& out, const string_snap_t &k)
-{
- return out << "(" << k.name << "," << k.snapid << ")";
-}
-
/*
* mds_table_pending_t
*
decode(tid, p);
}
void dump(ceph::Formatter *f) const;
+ void print(std::ostream& out) const {
+ out << name << ":" << tid;
+ }
entity_name_t name;
uint64_t tid = 0;
};
WRITE_CLASS_ENCODER(metareqid_t)
-inline std::ostream& operator<<(std::ostream& out, const metareqid_t& r) {
- return out << r.name << ":" << r.tid;
-}
-
inline bool operator==(const metareqid_t& l, const metareqid_t& r) {
return (l.name == r.name) && (l.tid == r.tid);
}
dirfrag_t() {}
dirfrag_t(inodeno_t i, frag_t f) : ino(i), frag(f) { }
+ void print(std::ostream& out) const {
+ out << ino;
+ if (!frag.is_root()) {
+ out << "." << frag;
+ }
+ }
+
void encode(ceph::buffer::list& bl) const {
using ceph::encode;
encode(ino, bl);
};
WRITE_CLASS_ENCODER(dirfrag_t)
-inline std::ostream& operator<<(std::ostream& out, const dirfrag_t &df) {
- out << df.ino;
- if (!df.frag.is_root()) out << "." << df.frag;
- return out;
-}
inline bool operator<(dirfrag_t l, dirfrag_t r) {
if (l.ino < r.ino) return true;
if (l.ino == r.ino && l.frag < r.frag) return true;
}
void dump(ceph::Formatter *f) const;
void dump(ceph::Formatter *f, const DecayRate& rate) const;
+ void print(std::ostream& out) const {
+ CachedStackStringStream css;
+ *css << std::setprecision(1) << std::fixed
+ << "[pop"
+ " IRD:" << vec[0]
+ << " IWR:" << vec[1]
+ << " RDR:" << vec[2]
+ << " FET:" << vec[3]
+ << " STR:" << vec[4]
+ << " *LOAD:" << meta_load() << "]";
+ out << css->strv();
+ }
static void generate_test_instances(std::list<dirfrag_load_vec_t*>& ls);
const DecayCounter &get(int t) const {
}
private:
- friend inline std::ostream& operator<<(std::ostream& out, const dirfrag_load_vec_t& dl);
std::array<DecayCounter, NUM> vec;
};
c.decode(p);
}
-inline std::ostream& operator<<(std::ostream& out, const dirfrag_load_vec_t& dl)
-{
- CachedStackStringStream css;
- *css << std::setprecision(1) << std::fixed
- << "[pop"
- " IRD:" << dl.vec[0]
- << " IWR:" << dl.vec[1]
- << " RDR:" << dl.vec[2]
- << " FET:" << dl.vec[3]
- << " STR:" << dl.vec[4]
- << " *LOAD:" << dl.meta_load() << "]";
- return out << css->strv();
-}
-
struct mds_load_t {
using clock = dirfrag_load_vec_t::clock;
using time = dirfrag_load_vec_t::time;
mds_load_t() : auth(DecayRate()), all(DecayRate()) {}
mds_load_t(const DecayRate &rate) : auth(rate), all(rate) {}
+ void print(std::ostream& out) const {
+ out << "mdsload<" << auth << "/" << all
+ << ", req " << req_rate
+ << ", hr " << cache_hit_rate
+ << ", qlen " << queue_len
+ << ", cpu " << cpu_load_avg
+ << ">";
+ }
+
double req_rate = 0.0;
double cache_hit_rate = 0.0;
double queue_len = 0.0;
c.decode(p);
}
-inline std::ostream& operator<<(std::ostream& out, const mds_load_t& load)
-{
- return out << "mdsload<" << load.auth << "/" << load.all
- << ", req " << load.req_rate
- << ", hr " << load.cache_hit_rate
- << ", qlen " << load.queue_len
- << ", cpu " << load.cpu_load_avg
- << ">";
-}
-
// ================================================================
typedef std::pair<mds_rank_t, mds_rank_t> mds_authority_t;
void encode(ceph::buffer::list& bl) const;
void decode(ceph::buffer::list::const_iterator& bl);
void dump(ceph::Formatter *f) const;
+ void print(std::ostream& out) const {
+ if (ino) {
+ out << ino << "." << snapid;
+ } else if (dname.length()) {
+ out << dirfrag << "/" << dname
+ << " snap " << snapid;
+ } else {
+ out << dirfrag;
+ }
+ }
static void generate_test_instances(std::list<MDSCacheObjectInfo*>& ls);
inodeno_t ino = 0;
snapid_t snapid;
};
-inline std::ostream& operator<<(std::ostream& out, const MDSCacheObjectInfo &info) {
- if (info.ino) return out << info.ino << "." << info.snapid;
- if (info.dname.length()) return out << info.dirfrag << "/" << info.dname
- << " snap " << info.snapid;
- return out << info.dirfrag;
-}
-
inline bool operator==(const MDSCacheObjectInfo& l, const MDSCacheObjectInfo& r) {
if (l.ino || r.ino)
return l.ino == r.ino && l.snapid == r.snapid;