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