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 : public Message {
24 bool client_must_resend;
27 MClientRequestForward()
28 : Message(CEPH_MSG_CLIENT_REQUEST_FORWARD),
29 dest_mds(-1), num_fwd(-1), client_must_resend(false) {}
30 MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) :
31 Message(CEPH_MSG_CLIENT_REQUEST_FORWARD),
32 dest_mds(dm), num_fwd(nf), client_must_resend(cmr) {
33 assert(client_must_resend);
37 ~MClientRequestForward() override {}
40 int get_dest_mds() { return dest_mds; }
41 int get_num_fwd() { return num_fwd; }
42 bool must_resend() { return client_must_resend; }
44 const char *get_type_name() const override { return "client_request_forward"; }
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":"")
53 void encode_payload(uint64_t features) override {
54 ::encode(dest_mds, payload);
55 ::encode(num_fwd, payload);
56 ::encode(client_must_resend, payload);
59 void decode_payload() override {
60 bufferlist::iterator p = payload.begin();
61 ::decode(dest_mds, p);
63 ::decode(client_must_resend, p);