]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDBackoff.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MOSDBackoff.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 Red Hat
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_MOSDBACKOFF_H
17 #define CEPH_MOSDBACKOFF_H
18
19 #include "MOSDFastDispatchOp.h"
20 #include "osd/osd_types.h"
21
22 class MOSDBackoff : public MessageInstance<MOSDBackoff, MOSDFastDispatchOp> {
23 public:
24 friend factory;
25
26 static constexpr int HEAD_VERSION = 1;
27 static constexpr int COMPAT_VERSION = 1;
28
29 spg_t pgid;
30 epoch_t map_epoch = 0;
31 uint8_t op = 0; ///< CEPH_OSD_BACKOFF_OP_*
32 uint64_t id = 0; ///< unique id within this session
33 hobject_t begin, end; ///< [) range to block, unless ==, block single obj
34
35 spg_t get_spg() const override {
36 return pgid;
37 }
38 epoch_t get_map_epoch() const override {
39 return map_epoch;
40 }
41
42 MOSDBackoff()
43 : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION) {}
44 MOSDBackoff(spg_t pgid_, epoch_t ep, uint8_t op_, uint64_t id_,
45 hobject_t begin_, hobject_t end_)
46 : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION),
47 pgid(pgid_),
48 map_epoch(ep),
49 op(op_),
50 id(id_),
51 begin(begin_),
52 end(end_) { }
53
54 void encode_payload(uint64_t features) override {
55 using ceph::encode;
56 encode(pgid, payload);
57 encode(map_epoch, payload);
58 encode(op, payload);
59 encode(id, payload);
60 encode(begin, payload);
61 encode(end, payload);
62 }
63
64 void decode_payload() override {
65 auto p = payload.cbegin();
66 decode(pgid, p);
67 decode(map_epoch, p);
68 decode(op, p);
69 decode(id, p);
70 decode(begin, p);
71 decode(end, p);
72 }
73
74 std::string_view get_type_name() const override { return "osd_backoff"; }
75
76 void print(ostream& out) const override {
77 out << "osd_backoff(" << pgid << " " << ceph_osd_backoff_op_name(op)
78 << " id " << id
79 << " [" << begin << "," << end << ")"
80 << " e" << map_epoch << ")";
81 }
82 };
83
84 #endif