]>
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 | ||
f67539c2 | 26 | class MMDSLoadTargets final : public PaxosServiceMessage { |
11fdf7f2 | 27 | public: |
7c673cae | 28 | mds_gid_t global_id; |
f67539c2 | 29 | std::set<mds_rank_t> targets; |
7c673cae | 30 | |
11fdf7f2 | 31 | protected: |
9f95a23c | 32 | MMDSLoadTargets() : PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0) {} |
f67539c2 | 33 | MMDSLoadTargets(mds_gid_t g, std::set<mds_rank_t>& mds_targets) : |
9f95a23c | 34 | PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0), |
7c673cae | 35 | global_id(g), targets(mds_targets) {} |
f67539c2 | 36 | ~MMDSLoadTargets() final {} |
7c673cae FG |
37 | |
38 | public: | |
11fdf7f2 | 39 | std::string_view get_type_name() const override { return "mds_load_targets"; } |
f67539c2 | 40 | void print(std::ostream& o) const override { |
7c673cae FG |
41 | o << "mds_load_targets(" << global_id << " " << targets << ")"; |
42 | } | |
43 | ||
44 | void decode_payload() override { | |
11fdf7f2 TL |
45 | using ceph::decode; |
46 | auto p = payload.cbegin(); | |
7c673cae | 47 | paxos_decode(p); |
11fdf7f2 TL |
48 | decode(global_id, p); |
49 | decode(targets, p); | |
7c673cae FG |
50 | } |
51 | ||
52 | void encode_payload(uint64_t features) override { | |
11fdf7f2 | 53 | using ceph::encode; |
7c673cae | 54 | paxos_encode(); |
11fdf7f2 TL |
55 | encode(global_id, payload); |
56 | encode(targets, payload); | |
7c673cae | 57 | } |
9f95a23c TL |
58 | private: |
59 | template<class T, typename... Args> | |
60 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
20effc67 TL |
61 | template<class T, typename... Args> |
62 | friend MURef<T> crimson::make_message(Args&&... args); | |
7c673cae FG |
63 | }; |
64 | ||
65 | #endif |