]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_MMONCOMMANDACK_H | |
16 | #define CEPH_MMONCOMMANDACK_H | |
17 | ||
18 | #include "messages/PaxosServiceMessage.h" | |
19 | ||
11fdf7f2 TL |
20 | class MMonCommandAck : public MessageInstance<MMonCommandAck, PaxosServiceMessage> { |
21 | public: | |
22 | friend factory; | |
23 | ||
7c673cae FG |
24 | vector<string> cmd; |
25 | errorcode32_t r; | |
26 | string rs; | |
27 | ||
11fdf7f2 | 28 | MMonCommandAck() : MessageInstance(MSG_MON_COMMAND_ACK, 0) {} |
7c673cae | 29 | MMonCommandAck(vector<string>& c, int _r, string s, version_t v) : |
11fdf7f2 | 30 | MessageInstance(MSG_MON_COMMAND_ACK, v), |
7c673cae FG |
31 | cmd(c), r(_r), rs(s) { } |
32 | private: | |
33 | ~MMonCommandAck() override {} | |
34 | ||
35 | public: | |
11fdf7f2 | 36 | std::string_view get_type_name() const override { return "mon_command"; } |
7c673cae FG |
37 | void print(ostream& o) const override { |
38 | o << "mon_command_ack(" << cmd << "=" << r << " " << rs << " v" << version << ")"; | |
39 | } | |
40 | ||
41 | void encode_payload(uint64_t features) override { | |
11fdf7f2 | 42 | using ceph::encode; |
7c673cae | 43 | paxos_encode(); |
11fdf7f2 TL |
44 | encode(r, payload); |
45 | encode(rs, payload); | |
46 | encode(cmd, payload); | |
7c673cae FG |
47 | } |
48 | void decode_payload() override { | |
11fdf7f2 | 49 | auto p = payload.cbegin(); |
7c673cae | 50 | paxos_decode(p); |
11fdf7f2 TL |
51 | decode(r, p); |
52 | decode(rs, p); | |
53 | decode(cmd, p); | |
7c673cae FG |
54 | } |
55 | }; | |
56 | ||
57 | #endif |