]>
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_MFSMAPCOMPACT_H | |
16 | #define CEPH_MFSMAPCOMPACT_H | |
17 | ||
18 | #include "msg/Message.h" | |
19 | #include "mds/FSMapUser.h" | |
20 | #include "include/ceph_features.h" | |
21 | ||
f67539c2 | 22 | class MFSMapUser final : public Message { |
11fdf7f2 | 23 | public: |
7c673cae FG |
24 | epoch_t epoch; |
25 | ||
26 | version_t get_epoch() const { return epoch; } | |
11fdf7f2 | 27 | const FSMapUser& get_fsmap() const { return fsmap; } |
7c673cae FG |
28 | |
29 | MFSMapUser() : | |
9f95a23c | 30 | Message{CEPH_MSG_FS_MAP_USER}, epoch(0) {} |
7c673cae | 31 | MFSMapUser(const uuid_d &f, const FSMapUser &fsmap_) : |
9f95a23c TL |
32 | Message{CEPH_MSG_FS_MAP_USER}, |
33 | epoch(fsmap_.epoch), | |
34 | fsmap{fsmap_} | |
35 | {} | |
7c673cae FG |
36 | private: |
37 | FSMapUser fsmap; | |
38 | ||
f67539c2 | 39 | ~MFSMapUser() final {} |
7c673cae FG |
40 | |
41 | public: | |
11fdf7f2 | 42 | std::string_view get_type_name() const override { return "fsmap.user"; } |
f67539c2 | 43 | void print(std::ostream& out) const override { |
7c673cae FG |
44 | out << "fsmap.user(e " << epoch << ")"; |
45 | } | |
46 | ||
47 | // marshalling | |
48 | void decode_payload() override { | |
f67539c2 | 49 | using ceph::decode; |
11fdf7f2 TL |
50 | auto p = payload.cbegin(); |
51 | decode(epoch, p); | |
52 | decode(fsmap, p); | |
7c673cae FG |
53 | } |
54 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
55 | using ceph::encode; |
56 | encode(epoch, payload); | |
57 | encode(fsmap, payload, features); | |
7c673cae | 58 | } |
9f95a23c TL |
59 | private: |
60 | template<class T, typename... Args> | |
61 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
62 | }; |
63 | ||
64 | #endif |