]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGUpdateLogMissing.h
update sources to v12.2.5
[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 : public MOSDFastDispatchOp {
22
23 static const int HEAD_VERSION = 3;
24 static const int COMPAT_VERSION = 1;
25
26
27 public:
28 epoch_t map_epoch, min_epoch;
29 spg_t pgid;
30 shard_id_t from;
31 ceph_tid_t rep_tid;
32 mempool::osd_pglog::list<pg_log_entry_t> entries;
33 // piggybacked osd/pg state
34 eversion_t pg_trim_to; // primary->replica: trim to here
35 eversion_t pg_roll_forward_to; // primary->replica: trim rollback info to here
36
37 epoch_t get_epoch() const { return map_epoch; }
38 spg_t get_pgid() const { return pgid; }
39 epoch_t get_query_epoch() const { return map_epoch; }
40 ceph_tid_t get_tid() const { return rep_tid; }
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 MOSDPGUpdateLogMissing()
53 : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
54 COMPAT_VERSION) { }
55 MOSDPGUpdateLogMissing(
56 const mempool::osd_pglog::list<pg_log_entry_t> &entries,
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 pg_trim_to,
63 eversion_t pg_roll_forward_to)
64 : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
65 COMPAT_VERSION),
66 map_epoch(epoch),
67 min_epoch(min_epoch),
68 pgid(pgid),
69 from(from),
70 rep_tid(rep_tid),
71 entries(entries),
72 pg_trim_to(pg_trim_to),
73 pg_roll_forward_to(pg_roll_forward_to)
74 {}
75
76 private:
77 ~MOSDPGUpdateLogMissing() override {}
78
79 public:
80 const char *get_type_name() const override { return "PGUpdateLogMissing"; }
81 void print(ostream& out) const override {
82 out << "pg_update_log_missing(" << pgid << " epoch " << map_epoch
83 << "/" << min_epoch
84 << " rep_tid " << rep_tid
85 << " entries " << entries
86 << " trim_to " << pg_trim_to
87 << " roll_forward_to " << pg_roll_forward_to
88 << ")";
89 }
90
91 void encode_payload(uint64_t features) override {
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 bufferlist::iterator p = payload.begin();
103 ::decode(map_epoch, p);
104 ::decode(pgid, p);
105 ::decode(from, p);
106 ::decode(rep_tid, p);
107 ::decode(entries, p);
108 if (header.version >= 2) {
109 ::decode(min_epoch, p);
110 } else {
111 min_epoch = map_epoch;
112 }
113 if (header.version >= 3) {
114 ::decode(pg_trim_to, p);
115 ::decode(pg_roll_forward_to, p);
116 }
117 }
118 };
119
120 #endif