]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGBackfillRemove.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / 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 class MOSDPGBackfillRemove : public MessageInstance<MOSDPGBackfillRemove, MOSDFastDispatchOp> {
25 public:
26 friend factory;
27
28 static constexpr int HEAD_VERSION = 1;
29 static constexpr int COMPAT_VERSION = 1;
30
31 spg_t pgid; ///< target spg_t
32 epoch_t map_epoch = 0;
33 list<pair<hobject_t,eversion_t>> ls; ///< objects to remove
34
35 epoch_t get_map_epoch() const override {
36 return map_epoch;
37 }
38 spg_t get_spg() const override {
39 return pgid;
40 }
41
42 MOSDPGBackfillRemove()
43 : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
44 COMPAT_VERSION) {}
45
46 MOSDPGBackfillRemove(spg_t pgid, epoch_t map_epoch)
47 : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION,
48 COMPAT_VERSION),
49 pgid(pgid),
50 map_epoch(map_epoch) {}
51
52 private:
53 ~MOSDPGBackfillRemove() {}
54
55 public:
56 std::string_view get_type_name() const override { return "backfill_remove"; }
57 void print(ostream& out) const override {
58 out << "backfill_remove(" << pgid << " e" << map_epoch
59 << " " << ls << ")";
60 }
61
62 void encode_payload(uint64_t features) override {
63 using ceph::encode;
64 encode(pgid, payload);
65 encode(map_epoch, payload);
66 encode(ls, payload);
67 }
68 void decode_payload() override {
69 auto p = payload.cbegin();
70 decode(pgid, p);
71 decode(map_epoch, p);
72 decode(ls, p);
73 }
74 };
75
76
77
78 #endif