Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MOSDPGUpdateLogMissingReply.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
16 #ifndef CEPH_MOSDPGUPDATELOGMISSINGREPLY_H
17 #define CEPH_MOSDPGUPDATELOGMISSINGREPLY_H
18
19 #include "MOSDFastDispatchOp.h"
20
21 class MOSDPGUpdateLogMissingReply : public MOSDFastDispatchOp {
22
23   static const int HEAD_VERSION = 2;
24   static const int COMPAT_VERSION = 1;
25
26
27 public:
28   epoch_t map_epoch, min_epoch;
29   spg_t pgid;
30   shard_id_t from;
31   ceph_tid_t rep_tid;
32
33   epoch_t get_epoch() const { return map_epoch; }
34   spg_t get_pgid() const { return pgid; }
35   epoch_t get_query_epoch() const { return map_epoch; }
36   ceph_tid_t get_tid() const { return rep_tid; }
37   pg_shard_t get_from() const {
38     return pg_shard_t(get_source().num(), from);
39   }
40   epoch_t get_map_epoch() const override {
41     return map_epoch;
42   }
43   epoch_t get_min_epoch() const override {
44     return min_epoch;
45   }
46   spg_t get_spg() const override {
47     return pgid;
48   }
49
50   MOSDPGUpdateLogMissingReply()
51     : MOSDFastDispatchOp(
52       MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY,
53       HEAD_VERSION,
54       COMPAT_VERSION)
55       {}
56   MOSDPGUpdateLogMissingReply(
57     spg_t pgid,
58     shard_id_t from,
59     epoch_t epoch,
60     epoch_t min_epoch,
61     ceph_tid_t rep_tid)
62     : MOSDFastDispatchOp(
63         MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY,
64         HEAD_VERSION,
65         COMPAT_VERSION),
66       map_epoch(epoch),
67       min_epoch(min_epoch),
68       pgid(pgid),
69       from(from),
70       rep_tid(rep_tid)
71     {}
72
73 private:
74   ~MOSDPGUpdateLogMissingReply() override {}
75
76 public:
77   const char *get_type_name() const override { return "PGUpdateLogMissingReply"; }
78   void print(ostream& out) const override {
79     out << "pg_update_log_missing_reply(" << pgid << " epoch " << map_epoch
80         << "/" << min_epoch
81         << " rep_tid " << rep_tid << ")";
82   }
83
84   void encode_payload(uint64_t features) override {
85     ::encode(map_epoch, payload);
86     ::encode(pgid, payload);
87     ::encode(from, payload);
88     ::encode(rep_tid, payload);
89     ::encode(min_epoch, payload);
90   }
91   void decode_payload() override {
92     bufferlist::iterator p = payload.begin();
93     ::decode(map_epoch, p);
94     ::decode(pgid, p);
95     ::decode(from, p);
96     ::decode(rep_tid, p);
97     if (header.version >= 2) {
98       ::decode(min_epoch, p);
99     } else {
100       min_epoch = map_epoch;
101     }
102   }
103 };
104
105 #endif