1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_MOSDPGRECOVERYDELETE_H
5 #define CEPH_MOSDPGRECOVERYDELETE_H
7 #include "MOSDFastDispatchOp.h"
8 #include "include/ceph_features.h"
11 * instruct non-primary to remove some objects during recovery
14 struct MOSDPGRecoveryDelete
: public MOSDFastDispatchOp
{
16 static const int HEAD_VERSION
= 2;
17 static const int COMPAT_VERSION
= 1;
20 spg_t pgid
; ///< target spg_t
21 epoch_t map_epoch
, min_epoch
;
22 list
<pair
<hobject_t
, eversion_t
> > objects
; ///< objects to remove
28 int get_cost() const override
{
32 epoch_t
get_map_epoch() const override
{
35 epoch_t
get_min_epoch() const override
{
38 spg_t
get_spg() const override
{
42 void set_cost(uint64_t c
) {
46 MOSDPGRecoveryDelete()
47 : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE
, HEAD_VERSION
,
48 COMPAT_VERSION
), cost(0) {}
50 MOSDPGRecoveryDelete(pg_shard_t from
, spg_t pgid
, epoch_t map_epoch
,
52 : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE
, HEAD_VERSION
,
61 ~MOSDPGRecoveryDelete() {}
64 const char *get_type_name() const { return "recovery_delete"; }
65 void print(ostream
& out
) const {
66 out
<< "MOSDPGRecoveryDelete(" << pgid
<< " e" << map_epoch
<< ","
67 << min_epoch
<< " " << objects
<< ")";
70 void encode_payload(uint64_t features
) {
71 ::encode(from
, payload
);
72 ::encode(pgid
, payload
);
73 ::encode(map_epoch
, payload
);
74 if (HAVE_FEATURE(features
, SERVER_LUMINOUS
)) {
75 ::encode(min_epoch
, payload
);
77 ::encode(cost
, payload
);
78 ::encode(objects
, payload
);
80 void decode_payload() {
81 bufferlist::iterator p
= payload
.begin();
84 ::decode(map_epoch
, p
);
85 if (header
.version
== 1 &&
86 !HAVE_FEATURE(get_connection()->get_features(), SERVER_LUMINOUS
)) {
87 min_epoch
= map_epoch
;
89 ::decode(min_epoch
, p
);