1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef CEPH_MCLIENTREQUESTFORWARD_H
17 #define CEPH_MCLIENTREQUESTFORWARD_H
19 #include "msg/Message.h"
21 class MClientRequestForward final
: public SafeMessage
{
25 bool client_must_resend
;
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
);
37 ~MClientRequestForward() final
{}
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
; }
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":"")
53 void encode_payload(uint64_t features
) override
{
55 encode(dest_mds
, payload
);
56 encode(num_fwd
, payload
);
57 encode(client_must_resend
, payload
);
60 void decode_payload() override
{
62 auto p
= payload
.cbegin();
65 decode(client_must_resend
, p
);
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
);