]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGUpdateLogMissing.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGUpdateLogMissing.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_MOSDPGUPDATELOGMISSING_H
17 #define CEPH_MOSDPGUPDATELOGMISSING_H
18
19 #include "MOSDFastDispatchOp.h"
20
21 class MOSDPGUpdateLogMissing final : public MOSDFastDispatchOp {
22 private:
23 static constexpr int HEAD_VERSION = 3;
24 static constexpr int COMPAT_VERSION = 1;
25
26 public:
27 epoch_t map_epoch = 0, min_epoch = 0;
28 spg_t pgid;
29 shard_id_t from;
30 ceph_tid_t rep_tid = 0;
31 mempool::osd_pglog::list<pg_log_entry_t> entries;
32 // piggybacked osd/pg state
33 eversion_t pg_trim_to; // primary->replica: trim to here
34 eversion_t pg_roll_forward_to; // primary->replica: trim rollback info to here
35
36 epoch_t get_epoch() const { return map_epoch; }
37 spg_t get_pgid() const { return pgid; }
38 epoch_t get_query_epoch() const { return map_epoch; }
39 ceph_tid_t get_tid() const { return rep_tid; }
40
41 epoch_t get_map_epoch() const override {
42 return map_epoch;
43 }
44 epoch_t get_min_epoch() const override {
45 return min_epoch;
46 }
47 spg_t get_spg() const override {
48 return pgid;
49 }
50
51 MOSDPGUpdateLogMissing()
52 : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
53 COMPAT_VERSION} {}
54 MOSDPGUpdateLogMissing(
55 const mempool::osd_pglog::list<pg_log_entry_t> &entries,
56 spg_t pgid,
57 shard_id_t from,
58 epoch_t epoch,
59 epoch_t min_epoch,
60 ceph_tid_t rep_tid,
61 eversion_t pg_trim_to,
62 eversion_t pg_roll_forward_to)
63 : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, 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 entries(entries),
71 pg_trim_to(pg_trim_to),
72 pg_roll_forward_to(pg_roll_forward_to)
73 {}
74
75 private:
76 ~MOSDPGUpdateLogMissing() final {}
77
78 public:
79 std::string_view get_type_name() const override { return "PGUpdateLogMissing"; }
80 void print(std::ostream& out) const override {
81 out << "pg_update_log_missing(" << pgid << " epoch " << map_epoch
82 << "/" << min_epoch
83 << " rep_tid " << rep_tid
84 << " entries " << entries
85 << " trim_to " << pg_trim_to
86 << " roll_forward_to " << pg_roll_forward_to
87 << ")";
88 }
89
90 void encode_payload(uint64_t features) override {
91 using ceph::encode;
92 encode(map_epoch, payload);
93 encode(pgid, payload);
94 encode(from, payload);
95 encode(rep_tid, payload);
96 encode(entries, payload);
97 encode(min_epoch, payload);
98 encode(pg_trim_to, payload);
99 encode(pg_roll_forward_to, payload);
100 }
101 void decode_payload() override {
102 using ceph::decode;
103 auto p = payload.cbegin();
104 decode(map_epoch, p);
105 decode(pgid, p);
106 decode(from, p);
107 decode(rep_tid, p);
108 decode(entries, p);
109 if (header.version >= 2) {
110 decode(min_epoch, p);
111 } else {
112 min_epoch = map_epoch;
113 }
114 if (header.version >= 3) {
115 decode(pg_trim_to, p);
116 decode(pg_roll_forward_to, p);
117 }
118 }
119 private:
120 template<class T, typename... Args>
121 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
122 };
123
124 #endif