]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDRepScrubMap.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / messages / MOSDRepScrubMap.h
CommitLineData
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) 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_MOSDREPSCRUBMAP_H
16#define CEPH_MOSDREPSCRUBMAP_H
17
18#include "MOSDFastDispatchOp.h"
19
20/*
21 * pass a ScrubMap from a shard back to the primary
22 */
23
24struct MOSDRepScrubMap : public MOSDFastDispatchOp {
25
26 static const int HEAD_VERSION = 1;
27 static const int COMPAT_VERSION = 1;
28
29 spg_t pgid; // primary spg_t
30 epoch_t map_epoch = 0;
31 pg_shard_t from; // whose scrubmap this is
32 bufferlist scrub_map_bl;
33
34 epoch_t get_map_epoch() const override {
35 return map_epoch;
36 }
37 spg_t get_spg() const override {
38 return pgid;
39 }
40
41 MOSDRepScrubMap()
42 : MOSDFastDispatchOp(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION) {}
43
44 MOSDRepScrubMap(spg_t pgid, epoch_t map_epoch, pg_shard_t from)
45 : MOSDFastDispatchOp(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION),
46 pgid(pgid),
47 map_epoch(map_epoch),
48 from(from) {}
49
50private:
51 ~MOSDRepScrubMap() {}
52
53public:
54 const char *get_type_name() const { return "rep_scrubmap"; }
55 void print(ostream& out) const {
56 out << "rep_scrubmap(" << pgid << " e" << map_epoch
57 << " from shard " << from << ")";
58 }
59
60 void encode_payload(uint64_t features) {
61 ::encode(pgid, payload);
62 ::encode(map_epoch, payload);
63 ::encode(from, payload);
64 }
65 void decode_payload() {
66 bufferlist::iterator p = payload.begin();
67 ::decode(pgid, p);
68 ::decode(map_epoch, p);
69 ::decode(from, p);
70 }
71};
72
73
74#endif