Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MPGStats.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software 
11  * Foundation.  See file COPYING.
12  * 
13  */
14
15 #ifndef CEPH_MPGSTATS_H
16 #define CEPH_MPGSTATS_H
17
18 #include "osd/osd_types.h"
19 #include "messages/PaxosServiceMessage.h"
20
21 class MPGStats : public PaxosServiceMessage {
22 public:
23   uuid_d fsid;
24   map<pg_t,pg_stat_t> pg_stat;
25   osd_stat_t osd_stat;
26   epoch_t epoch = 0;
27   utime_t had_map_for;
28   
29   MPGStats() : PaxosServiceMessage(MSG_PGSTATS, 0) {}
30   MPGStats(const uuid_d& f, epoch_t e, utime_t had)
31     : PaxosServiceMessage(MSG_PGSTATS, 0),
32       fsid(f),
33       epoch(e),
34       had_map_for(had)
35   {}
36
37 private:
38   ~MPGStats() override {}
39
40 public:
41   const char *get_type_name() const override { return "pg_stats"; }
42   void print(ostream& out) const override {
43     out << "pg_stats(" << pg_stat.size() << " pgs tid " << get_tid() << " v " << version << ")";
44   }
45
46   void encode_payload(uint64_t features) override {
47     paxos_encode();
48     ::encode(fsid, payload);
49     ::encode(osd_stat, payload);
50     ::encode(pg_stat, payload);
51     ::encode(epoch, payload);
52     ::encode(had_map_for, payload);
53   }
54   void decode_payload() override {
55     bufferlist::iterator p = payload.begin();
56     paxos_decode(p);
57     ::decode(fsid, p);
58     ::decode(osd_stat, p);
59     ::decode(pg_stat, p);
60     ::decode(epoch, p);
61     ::decode(had_map_for, p);
62   }
63 };
64
65 #endif