]>
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_MCLIENTRECLAIMREPLY_H | |
17 | #define CEPH_MCLIENTRECLAIMREPLY_H | |
18 | ||
19 | #include "msg/Message.h" | |
20 | ||
9f95a23c | 21 | class MClientReclaimReply: public SafeMessage { |
11fdf7f2 TL |
22 | public: |
23 | static constexpr int HEAD_VERSION = 1; | |
24 | static constexpr int COMPAT_VERSION = 1; | |
25 | ||
26 | int32_t get_result() const { return result; } | |
27 | void set_result(int r) { result = r; } | |
28 | epoch_t get_epoch() const { return epoch; } | |
29 | void set_epoch(epoch_t e) { epoch = e; } | |
30 | const entity_addrvec_t& get_addrs() const { return addrs; } | |
31 | void set_addrs(const entity_addrvec_t& _addrs) { addrs = _addrs; } | |
32 | ||
33 | std::string_view get_type_name() const override { return "client_reclaim_reply"; } | |
34 | void print(ostream& o) const override { | |
35 | o << "client_reclaim_reply(" << result << " e " << epoch << ")"; | |
36 | } | |
37 | ||
38 | void encode_payload(uint64_t features) override { | |
39 | using ceph::encode; | |
40 | encode(result, payload); | |
41 | encode(epoch, payload); | |
42 | encode(addrs, payload, features); | |
43 | } | |
44 | ||
45 | void decode_payload() override { | |
46 | using ceph::decode; | |
47 | auto p = payload.cbegin(); | |
48 | decode(result, p); | |
49 | decode(epoch, p); | |
50 | decode(addrs, p); | |
51 | } | |
52 | ||
53 | protected: | |
11fdf7f2 | 54 | MClientReclaimReply() : |
9f95a23c TL |
55 | MClientReclaimReply{0, 0} |
56 | {} | |
11fdf7f2 | 57 | MClientReclaimReply(int r, epoch_t e=0) : |
9f95a23c | 58 | SafeMessage{CEPH_MSG_CLIENT_RECLAIM_REPLY, HEAD_VERSION, COMPAT_VERSION}, |
11fdf7f2 TL |
59 | result(r), epoch(e) {} |
60 | ||
61 | private: | |
62 | ~MClientReclaimReply() override {} | |
63 | ||
64 | int32_t result; | |
65 | epoch_t epoch; | |
66 | entity_addrvec_t addrs; | |
9f95a23c TL |
67 | |
68 | template<class T, typename... Args> | |
69 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
11fdf7f2 TL |
70 | }; |
71 | ||
72 | #endif |