]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGUpdateLogMissingReply.h
import 15.2.0 Octopus source
[ceph.git] / 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 private:
23 static constexpr int HEAD_VERSION = 3;
24 static constexpr int COMPAT_VERSION = 1;
25
26
27 public:
28 epoch_t map_epoch = 0, min_epoch = 0;
29 spg_t pgid;
30 shard_id_t from;
31 ceph_tid_t rep_tid = 0;
32 // piggybacked osd state
33 eversion_t last_complete_ondisk;
34
35 epoch_t get_epoch() const { return map_epoch; }
36 spg_t get_pgid() const { return pgid; }
37 epoch_t get_query_epoch() const { return map_epoch; }
38 ceph_tid_t get_tid() const { return rep_tid; }
39 pg_shard_t get_from() const {
40 return pg_shard_t(get_source().num(), from);
41 }
42 epoch_t get_map_epoch() const override {
43 return map_epoch;
44 }
45 epoch_t get_min_epoch() const override {
46 return min_epoch;
47 }
48 spg_t get_spg() const override {
49 return pgid;
50 }
51
52 MOSDPGUpdateLogMissingReply()
53 : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, 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 eversion_t last_complete_ondisk)
63 : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION,
64 COMPAT_VERSION},
65 map_epoch(epoch),
66 min_epoch(min_epoch),
67 pgid(pgid),
68 from(from),
69 rep_tid(rep_tid),
70 last_complete_ondisk(last_complete_ondisk)
71 {}
72
73 private:
74 ~MOSDPGUpdateLogMissingReply() override {}
75
76 public:
77 std::string_view 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 << " lcod " << last_complete_ondisk << ")";
83 }
84
85 void encode_payload(uint64_t features) override {
86 using ceph::encode;
87 encode(map_epoch, payload);
88 encode(pgid, payload);
89 encode(from, payload);
90 encode(rep_tid, payload);
91 encode(min_epoch, payload);
92 encode(last_complete_ondisk, payload);
93 }
94 void decode_payload() override {
95 auto p = payload.cbegin();
96 decode(map_epoch, p);
97 decode(pgid, p);
98 decode(from, p);
99 decode(rep_tid, p);
100 if (header.version >= 2) {
101 decode(min_epoch, p);
102 } else {
103 min_epoch = map_epoch;
104 }
105 if (header.version >= 3) {
106 decode(last_complete_ondisk, p);
107 }
108 }
109 private:
110 template<class T, typename... Args>
111 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
112 };
113
114 #endif