]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #pragma once | |
5 | ||
6 | #include <vector> | |
7 | ||
8 | #include "msg/Message.h" | |
9 | ||
10 | class MMgrCommand : public Message { | |
11 | public: | |
12 | uuid_d fsid; | |
13 | std::vector<std::string> cmd; | |
14 | ||
15 | MMgrCommand() | |
16 | : Message{MSG_MGR_COMMAND} {} | |
17 | MMgrCommand(const uuid_d &f) | |
18 | : Message{MSG_MGR_COMMAND}, | |
19 | fsid(f) { } | |
20 | ||
21 | private: | |
22 | ~MMgrCommand() override {} | |
23 | ||
24 | public: | |
25 | std::string_view get_type_name() const override { return "mgr_command"; } | |
26 | void print(std::ostream& o) const override { | |
27 | o << "mgr_command(tid " << get_tid() << ": "; | |
28 | for (unsigned i=0; i<cmd.size(); i++) { | |
29 | if (i) o << ' '; | |
30 | o << cmd[i]; | |
31 | } | |
32 | o << ")"; | |
33 | } | |
34 | ||
35 | void encode_payload(uint64_t features) override { | |
36 | using ceph::encode; | |
37 | encode(fsid, payload); | |
38 | encode(cmd, payload); | |
39 | } | |
40 | void decode_payload() override { | |
41 | using ceph::decode; | |
42 | auto p = payload.cbegin(); | |
43 | decode(fsid, p); | |
44 | decode(cmd, p); | |
45 | } | |
46 | }; |