]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MCommand.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / messages / MCommand.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 #ifndef CEPH_MCOMMAND_H
16 #define CEPH_MCOMMAND_H
17
18 #include <vector>
19
20 #include "msg/Message.h"
21
22 class MCommand final : public Message {
23 public:
24 uuid_d fsid;
25 std::vector<std::string> cmd;
26
27 MCommand()
28 : Message{MSG_COMMAND} {}
29 MCommand(const uuid_d &f)
30 : Message{MSG_COMMAND},
31 fsid(f) { }
32
33 private:
34 ~MCommand() final {}
35
36 public:
37 std::string_view get_type_name() const override { return "command"; }
38 void print(std::ostream& o) const override {
39 o << "command(tid " << get_tid() << ": ";
40 for (unsigned i=0; i<cmd.size(); i++) {
41 if (i) o << ' ';
42 o << cmd[i];
43 }
44 o << ")";
45 }
46
47 void encode_payload(uint64_t features) override {
48 using ceph::encode;
49 encode(fsid, payload);
50 encode(cmd, payload);
51 }
52 void decode_payload() override {
53 using ceph::decode;
54 auto p = payload.cbegin();
55 decode(fsid, p);
56 decode(cmd, p);
57 }
58 };
59
60 #endif