]>
Commit | Line | Data |
---|---|---|
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_MOSDPGUPDATELOGMISSINGREPLY_H | |
17 | #define CEPH_MOSDPGUPDATELOGMISSINGREPLY_H | |
18 | ||
19 | #include "MOSDFastDispatchOp.h" | |
20 | ||
11fdf7f2 TL |
21 | class MOSDPGUpdateLogMissingReply : public MessageInstance<MOSDPGUpdateLogMissingReply, MOSDFastDispatchOp> { |
22 | public: | |
23 | friend factory; | |
24 | private: | |
25 | static constexpr int HEAD_VERSION = 3; | |
26 | static constexpr int COMPAT_VERSION = 1; | |
7c673cae FG |
27 | |
28 | ||
29 | public: | |
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; |
94b18763 FG |
34 | // piggybacked osd state |
35 | eversion_t last_complete_ondisk; | |
7c673cae FG |
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 | pg_shard_t get_from() const { | |
42 | return pg_shard_t(get_source().num(), from); | |
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 | MOSDPGUpdateLogMissingReply() | |
11fdf7f2 | 55 | : MessageInstance( |
7c673cae FG |
56 | MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, |
57 | HEAD_VERSION, | |
58 | COMPAT_VERSION) | |
59 | {} | |
60 | MOSDPGUpdateLogMissingReply( | |
61 | spg_t pgid, | |
62 | shard_id_t from, | |
63 | epoch_t epoch, | |
64 | epoch_t min_epoch, | |
94b18763 FG |
65 | ceph_tid_t rep_tid, |
66 | eversion_t last_complete_ondisk) | |
11fdf7f2 | 67 | : MessageInstance( |
7c673cae FG |
68 | MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, |
69 | HEAD_VERSION, | |
70 | COMPAT_VERSION), | |
71 | map_epoch(epoch), | |
72 | min_epoch(min_epoch), | |
73 | pgid(pgid), | |
74 | from(from), | |
94b18763 FG |
75 | rep_tid(rep_tid), |
76 | last_complete_ondisk(last_complete_ondisk) | |
7c673cae FG |
77 | {} |
78 | ||
79 | private: | |
80 | ~MOSDPGUpdateLogMissingReply() override {} | |
81 | ||
82 | public: | |
11fdf7f2 | 83 | std::string_view get_type_name() const override { return "PGUpdateLogMissingReply"; } |
7c673cae FG |
84 | void print(ostream& out) const override { |
85 | out << "pg_update_log_missing_reply(" << pgid << " epoch " << map_epoch | |
86 | << "/" << min_epoch | |
94b18763 FG |
87 | << " rep_tid " << rep_tid |
88 | << " lcod " << last_complete_ondisk << ")"; | |
7c673cae FG |
89 | } |
90 | ||
91 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
92 | using ceph::encode; |
93 | encode(map_epoch, payload); | |
94 | encode(pgid, payload); | |
95 | encode(from, payload); | |
96 | encode(rep_tid, payload); | |
97 | encode(min_epoch, payload); | |
98 | encode(last_complete_ondisk, payload); | |
7c673cae FG |
99 | } |
100 | void decode_payload() override { | |
11fdf7f2 TL |
101 | auto p = payload.cbegin(); |
102 | decode(map_epoch, p); | |
103 | decode(pgid, p); | |
104 | decode(from, p); | |
105 | decode(rep_tid, p); | |
7c673cae | 106 | if (header.version >= 2) { |
11fdf7f2 | 107 | decode(min_epoch, p); |
7c673cae FG |
108 | } else { |
109 | min_epoch = map_epoch; | |
110 | } | |
94b18763 | 111 | if (header.version >= 3) { |
11fdf7f2 | 112 | decode(last_complete_ondisk, p); |
94b18763 | 113 | } |
7c673cae FG |
114 | } |
115 | }; | |
116 | ||
117 | #endif |