]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDECSubOpReadReply.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDECSubOpReadReply.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) 2013 Inktank Storage, Inc.
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 MOSDECSUBOPREADREPLY_H
16 #define MOSDECSUBOPREADREPLY_H
17
18 #include "MOSDFastDispatchOp.h"
19 #include "osd/ECMsgTypes.h"
20
21 class MOSDECSubOpReadReply : public MOSDFastDispatchOp {
22 private:
23 static constexpr int HEAD_VERSION = 2;
24 static constexpr int COMPAT_VERSION = 1;
25
26 public:
27 spg_t pgid;
28 epoch_t map_epoch = 0, min_epoch = 0;
29 ECSubReadReply op;
30
31 int get_cost() const override {
32 return 0;
33 }
34 epoch_t get_map_epoch() const override {
35 return map_epoch;
36 }
37 epoch_t get_min_epoch() const override {
38 return min_epoch;
39 }
40 spg_t get_spg() const override {
41 return pgid;
42 }
43
44 MOSDECSubOpReadReply()
45 : MOSDFastDispatchOp{MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION}
46 {}
47
48 void decode_payload() override {
49 using ceph::decode;
50 auto p = payload.cbegin();
51 decode(pgid, p);
52 decode(map_epoch, p);
53 decode(op, p);
54 if (header.version >= 2) {
55 decode(min_epoch, p);
56 decode_trace(p);
57 } else {
58 min_epoch = map_epoch;
59 }
60 }
61
62 void encode_payload(uint64_t features) override {
63 using ceph::encode;
64 encode(pgid, payload);
65 encode(map_epoch, payload);
66 encode(op, payload);
67 encode(min_epoch, payload);
68 encode_trace(payload, features);
69 }
70
71 std::string_view get_type_name() const override { return "MOSDECSubOpReadReply"; }
72
73 void print(std::ostream& out) const override {
74 out << "MOSDECSubOpReadReply(" << pgid
75 << " " << map_epoch << "/" << min_epoch
76 << " " << op;
77 out << ")";
78 }
79 private:
80 template<class T, typename... Args>
81 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
82 };
83
84 #endif