]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMDSTableRequest.h
65489cd7dc92d807353fa049fba98d9f323b5fa4
[ceph.git] / ceph / src / messages / MMDSTableRequest.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_MMDSTABLEREQUEST_H
17 #define CEPH_MMDSTABLEREQUEST_H
18
19 #include "msg/Message.h"
20 #include "mds/mds_table_types.h"
21
22 class MMDSTableRequest : public Message {
23 public:
24 __u16 table;
25 __s16 op;
26 uint64_t reqid;
27 bufferlist bl;
28
29 MMDSTableRequest() : Message(MSG_MDS_TABLE_REQUEST) {}
30 MMDSTableRequest(int tab, int o, uint64_t r, version_t v=0) :
31 Message(MSG_MDS_TABLE_REQUEST),
32 table(tab), op(o), reqid(r) {
33 set_tid(v);
34 }
35 private:
36 ~MMDSTableRequest() override {}
37
38 public:
39 const char *get_type_name() const override { return "mds_table_request"; }
40 void print(ostream& o) const override {
41 o << "mds_table_request(" << get_mdstable_name(table)
42 << " " << get_mdstableserver_opname(op);
43 if (reqid) o << " " << reqid;
44 if (get_tid()) o << " tid " << get_tid();
45 if (bl.length()) o << " " << bl.length() << " bytes";
46 o << ")";
47 }
48
49 void decode_payload() override {
50 bufferlist::iterator p = payload.begin();
51 ::decode(table, p);
52 ::decode(op, p);
53 ::decode(reqid, p);
54 ::decode(bl, p);
55 }
56
57 void encode_payload(uint64_t features) override {
58 ::encode(table, payload);
59 ::encode(op, payload);
60 ::encode(reqid, payload);
61 ::encode(bl, payload);
62 }
63 };
64
65 #endif