Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MOSDPGRecoveryDeleteReply.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef MOSDRECOVERYDELETEREPLY_H
5 #define MOSDRECOVERYDELETEREPLY_H
6
7 #include "MOSDFastDispatchOp.h"
8 #include "include/ceph_features.h"
9
10 struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp {
11   static const int HEAD_VERSION = 2;
12   static const int COMPAT_VERSION = 1;
13
14   pg_shard_t from;
15   spg_t pgid;
16   epoch_t map_epoch, min_epoch;
17   list<pair<hobject_t, eversion_t> > objects;
18
19   epoch_t get_map_epoch() const override {
20     return map_epoch;
21   }
22   epoch_t get_min_epoch() const override {
23     return min_epoch;
24   }
25   spg_t get_spg() const override {
26     return pgid;
27   }
28
29   MOSDPGRecoveryDeleteReply()
30     : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION),
31       map_epoch(0), min_epoch(0)
32     {}
33
34   void decode_payload() override {
35     bufferlist::iterator p = payload.begin();
36     ::decode(pgid.pgid, p);
37     ::decode(map_epoch, p);
38     if (header.version == 1 &&
39         !HAVE_FEATURE(get_connection()->get_features(), SERVER_LUMINOUS)) {
40       min_epoch = map_epoch;
41     } else {
42       ::decode(min_epoch, p);
43     }
44     ::decode(objects, p);
45     ::decode(pgid.shard, p);
46     ::decode(from, p);
47   }
48
49   void encode_payload(uint64_t features) override {
50     ::encode(pgid.pgid, payload);
51     ::encode(map_epoch, payload);
52     if (HAVE_FEATURE(features, SERVER_LUMINOUS)) {
53       ::encode(min_epoch, payload);
54     }
55     ::encode(objects, payload);
56     ::encode(pgid.shard, payload);
57     ::encode(from, payload);
58   }
59
60   void print(ostream& out) const override {
61     out << "MOSDPGRecoveryDeleteReply(" << pgid
62         << " e" << map_epoch << "," << min_epoch << " " << objects << ")";
63   }
64
65   const char *get_type_name() const override { return "recovery_delete_reply"; }
66 };
67
68 #endif