]>
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) 2009 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_MMDSLoadTargets_H | |
16 | #define CEPH_MMDSLoadTargets_H | |
17 | ||
18 | #include "msg/Message.h" | |
19 | #include "mds/mdstypes.h" | |
20 | #include "messages/PaxosServiceMessage.h" | |
21 | #include "include/types.h" | |
22 | ||
23 | #include <map> | |
24 | using std::map; | |
25 | ||
11fdf7f2 TL |
26 | class MMDSLoadTargets : public MessageInstance<MMDSLoadTargets, PaxosServiceMessage> { |
27 | public: | |
28 | friend factory; | |
29 | ||
7c673cae FG |
30 | mds_gid_t global_id; |
31 | set<mds_rank_t> targets; | |
32 | ||
11fdf7f2 TL |
33 | protected: |
34 | MMDSLoadTargets() : MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0) {} | |
7c673cae | 35 | MMDSLoadTargets(mds_gid_t g, set<mds_rank_t>& mds_targets) : |
11fdf7f2 | 36 | MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0), |
7c673cae | 37 | global_id(g), targets(mds_targets) {} |
7c673cae FG |
38 | ~MMDSLoadTargets() override {} |
39 | ||
40 | public: | |
11fdf7f2 | 41 | std::string_view get_type_name() const override { return "mds_load_targets"; } |
7c673cae FG |
42 | void print(ostream& o) const override { |
43 | o << "mds_load_targets(" << global_id << " " << targets << ")"; | |
44 | } | |
45 | ||
46 | void decode_payload() override { | |
11fdf7f2 TL |
47 | using ceph::decode; |
48 | auto p = payload.cbegin(); | |
7c673cae | 49 | paxos_decode(p); |
11fdf7f2 TL |
50 | decode(global_id, p); |
51 | decode(targets, p); | |
7c673cae FG |
52 | } |
53 | ||
54 | void encode_payload(uint64_t features) override { | |
11fdf7f2 | 55 | using ceph::encode; |
7c673cae | 56 | paxos_encode(); |
11fdf7f2 TL |
57 | encode(global_id, payload); |
58 | encode(targets, payload); | |
7c673cae FG |
59 | } |
60 | }; | |
61 | ||
62 | #endif |