]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MClientReclaim.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / messages / MClientReclaim.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) 2004-2006 Sage Weil <sage@newdream.net>
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_MCLIENTRECLAIM_H
17 #define CEPH_MCLIENTRECLAIM_H
18
19 #include "msg/Message.h"
20
21 class MClientReclaim final : public SafeMessage {
22 public:
23 static constexpr int HEAD_VERSION = 1;
24 static constexpr int COMPAT_VERSION = 1;
25 static constexpr uint32_t FLAG_FINISH = 1U << 31;
26
27 uint32_t get_flags() const { return flags; }
28 std::string_view get_uuid() const { return uuid; }
29
30 std::string_view get_type_name() const override { return "client_reclaim"; }
31 void print(std::ostream& o) const override {
32 std::ios_base::fmtflags f(o.flags());
33 o << "client_reclaim(" << get_uuid() << " flags 0x" << std::hex << get_flags() << ")";
34 o.flags(f);
35 }
36
37 void encode_payload(uint64_t features) override {
38 using ceph::encode;
39 encode(uuid, payload);
40 encode(flags, payload);
41 }
42
43 void decode_payload() override {
44 using ceph::decode;
45 auto p = payload.cbegin();
46 decode(uuid, p);
47 decode(flags, p);
48 }
49
50 protected:
51 MClientReclaim() :
52 SafeMessage{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION} {}
53 MClientReclaim(std::string_view _uuid, uint32_t _flags) :
54 SafeMessage{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION},
55 uuid(_uuid), flags(_flags) {}
56 private:
57 ~MClientReclaim() final {}
58
59 std::string uuid;
60 uint32_t flags = 0;
61
62 template<class T, typename... Args>
63 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
64 template<class T, typename... Args>
65 friend MURef<T> crimson::make_message(Args&&... args);
66 };
67
68 #endif