]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_MCLIENTREQUESTFORWARD_H | |
17 | #define CEPH_MCLIENTREQUESTFORWARD_H | |
18 | ||
19 | #include "msg/Message.h" | |
20 | ||
9f95a23c | 21 | class MClientRequestForward : public SafeMessage { |
11fdf7f2 | 22 | private: |
7c673cae FG |
23 | int32_t dest_mds; |
24 | int32_t num_fwd; | |
25 | bool client_must_resend; | |
26 | ||
11fdf7f2 | 27 | protected: |
7c673cae | 28 | MClientRequestForward() |
9f95a23c | 29 | : SafeMessage{CEPH_MSG_CLIENT_REQUEST_FORWARD}, |
7c673cae FG |
30 | dest_mds(-1), num_fwd(-1), client_must_resend(false) {} |
31 | MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) : | |
9f95a23c | 32 | SafeMessage{CEPH_MSG_CLIENT_REQUEST_FORWARD}, |
7c673cae | 33 | dest_mds(dm), num_fwd(nf), client_must_resend(cmr) { |
11fdf7f2 | 34 | ceph_assert(client_must_resend); |
7c673cae FG |
35 | header.tid = t; |
36 | } | |
7c673cae FG |
37 | ~MClientRequestForward() override {} |
38 | ||
39 | public: | |
11fdf7f2 TL |
40 | int get_dest_mds() const { return dest_mds; } |
41 | int get_num_fwd() const { return num_fwd; } | |
42 | bool must_resend() const { return client_must_resend; } | |
7c673cae | 43 | |
11fdf7f2 | 44 | std::string_view get_type_name() const override { return "client_request_forward"; } |
7c673cae FG |
45 | void print(ostream& o) const override { |
46 | o << "client_request_forward(" << get_tid() | |
47 | << " to mds." << dest_mds | |
48 | << " num_fwd=" << num_fwd | |
49 | << (client_must_resend ? " client_must_resend":"") | |
50 | << ")"; | |
51 | } | |
52 | ||
53 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
54 | using ceph::encode; |
55 | encode(dest_mds, payload); | |
56 | encode(num_fwd, payload); | |
57 | encode(client_must_resend, payload); | |
7c673cae FG |
58 | } |
59 | ||
60 | void decode_payload() override { | |
11fdf7f2 TL |
61 | auto p = payload.cbegin(); |
62 | decode(dest_mds, p); | |
63 | decode(num_fwd, p); | |
64 | decode(client_must_resend, p); | |
7c673cae | 65 | } |
9f95a23c TL |
66 | private: |
67 | template<class T, typename... Args> | |
68 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
69 | }; |
70 | ||
71 | #endif |