]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
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 | ||
f67539c2 | 21 | class MClientReclaim final : public SafeMessage { |
11fdf7f2 TL |
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"; } | |
f67539c2 | 31 | void print(std::ostream& o) const override { |
11fdf7f2 TL |
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: | |
11fdf7f2 | 51 | MClientReclaim() : |
9f95a23c | 52 | SafeMessage{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION} {} |
11fdf7f2 | 53 | MClientReclaim(std::string_view _uuid, uint32_t _flags) : |
9f95a23c | 54 | SafeMessage{CEPH_MSG_CLIENT_RECLAIM, HEAD_VERSION, COMPAT_VERSION}, |
11fdf7f2 TL |
55 | uuid(_uuid), flags(_flags) {} |
56 | private: | |
f67539c2 | 57 | ~MClientReclaim() final {} |
11fdf7f2 TL |
58 | |
59 | std::string uuid; | |
60 | uint32_t flags = 0; | |
9f95a23c TL |
61 | |
62 | template<class T, typename... Args> | |
63 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
20effc67 TL |
64 | template<class T, typename... Args> |
65 | friend MURef<T> crimson::make_message(Args&&... args); | |
11fdf7f2 TL |
66 | }; |
67 | ||
68 | #endif |