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