Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MOSDPGBackfillRemove.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) 2017 Sage Weil <sage@redhat.com>
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 #ifndef CEPH_MOSDPGBACKFILLREMOVE_H
16 #define CEPH_MOSDPGBACKFILLREMOVE_H
17
18 #include "MOSDFastDispatchOp.h"
19
20 /*
21  * instruct non-primary to remove some objects during backfill
22  */
23
24 struct MOSDPGBackfillRemove : public MOSDFastDispatchOp {
25
26   static const int HEAD_VERSION = 1;
27   static const int COMPAT_VERSION = 1;
28
29   spg_t pgid;            ///< target spg_t
30   epoch_t map_epoch = 0;
31   list<pair<hobject_t,eversion_t>> ls;    ///< objects to remove
32
33   epoch_t get_map_epoch() const override {
34     return map_epoch;
35   }
36   spg_t get_spg() const override {
37     return pgid;
38   }
39
40   MOSDPGBackfillRemove()
41     : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
42                         COMPAT_VERSION) {}
43
44   MOSDPGBackfillRemove(spg_t pgid, epoch_t map_epoch)
45     : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
46                          COMPAT_VERSION),
47       pgid(pgid),
48       map_epoch(map_epoch) {}
49
50 private:
51   ~MOSDPGBackfillRemove() {}
52
53 public:
54   const char *get_type_name() const { return "backfill_remove"; }
55   void print(ostream& out) const {
56     out << "backfill_remove(" << pgid << " e" << map_epoch
57         << " " << ls << ")";
58   }
59
60   void encode_payload(uint64_t features) {
61     ::encode(pgid, payload);
62     ::encode(map_epoch, payload);
63     ::encode(ls, payload);
64   }
65   void decode_payload() {
66     bufferlist::iterator p = payload.begin();
67     ::decode(pgid, p);
68     ::decode(map_epoch, p);
69     ::decode(ls, p);
70   }
71 };
72
73
74
75 #endif