]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MClientRequestForward.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / messages / MClientRequestForward.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_MCLIENTREQUESTFORWARD_H
17 #define CEPH_MCLIENTREQUESTFORWARD_H
18
19 #include "msg/Message.h"
20
21 class MClientRequestForward final : public SafeMessage {
22 private:
23 int32_t dest_mds;
24 int32_t num_fwd;
25 bool client_must_resend;
26
27 protected:
28 MClientRequestForward()
29 : SafeMessage{CEPH_MSG_CLIENT_REQUEST_FORWARD},
30 dest_mds(-1), num_fwd(-1), client_must_resend(false) {}
31 MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) :
32 SafeMessage{CEPH_MSG_CLIENT_REQUEST_FORWARD},
33 dest_mds(dm), num_fwd(nf), client_must_resend(cmr) {
34 ceph_assert(client_must_resend);
35 header.tid = t;
36 }
37 ~MClientRequestForward() final {}
38
39 public:
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; }
43
44 std::string_view get_type_name() const override { return "client_request_forward"; }
45 void print(std::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 {
54 using ceph::encode;
55 encode(dest_mds, payload);
56 encode(num_fwd, payload);
57 encode(client_must_resend, payload);
58 }
59
60 void decode_payload() override {
61 using ceph::decode;
62 auto p = payload.cbegin();
63 decode(dest_mds, p);
64 decode(num_fwd, p);
65 decode(client_must_resend, p);
66 }
67 private:
68 template<class T, typename... Args>
69 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
70 template<class T, typename... Args>
71 friend MURef<T> crimson::make_message(Args&&... args);
72 };
73
74 #endif