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