1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2017 Red Hat
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.
16 #ifndef CEPH_MOSDBACKOFF_H
17 #define CEPH_MOSDBACKOFF_H
19 #include "MOSDFastDispatchOp.h"
20 #include "osd/osd_types.h"
22 class MOSDBackoff : public MOSDFastDispatchOp {
24 static constexpr int HEAD_VERSION = 1;
25 static constexpr int COMPAT_VERSION = 1;
28 epoch_t map_epoch = 0;
29 uint8_t op = 0; ///< CEPH_OSD_BACKOFF_OP_*
30 uint64_t id = 0; ///< unique id within this session
31 hobject_t begin, end; ///< [) range to block, unless ==, block single obj
33 spg_t get_spg() const override {
36 epoch_t get_map_epoch() const override {
41 : MOSDFastDispatchOp(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION) {}
42 MOSDBackoff(spg_t pgid_, epoch_t ep, uint8_t op_, uint64_t id_,
43 hobject_t begin_, hobject_t end_)
44 : MOSDFastDispatchOp(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION),
52 void encode_payload(uint64_t features) override {
53 ::encode(pgid, payload);
54 ::encode(map_epoch, payload);
55 ::encode(op, payload);
56 ::encode(id, payload);
57 ::encode(begin, payload);
58 ::encode(end, payload);
61 void decode_payload() override {
62 auto p = payload.begin();
64 ::decode(map_epoch, p);
71 const char *get_type_name() const override { return "osd_backoff"; }
73 void print(ostream& out) const override {
74 out << "osd_backoff(" << pgid << " " << ceph_osd_backoff_op_name(op)
76 << " [" << begin << "," << end << ")"
77 << " e" << map_epoch << ")";