]>
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_MEXPORTDIRFINISH_H | |
16 | #define CEPH_MEXPORTDIRFINISH_H | |
17 | ||
f67539c2 | 18 | #include "messages/MMDSOp.h" |
7c673cae | 19 | |
f67539c2 | 20 | class MExportDirFinish final : public MMDSOp { |
11fdf7f2 | 21 | private: |
f67539c2 TL |
22 | static constexpr int HEAD_VERSION = 1; |
23 | static constexpr int COMPAT_VERSION = 1; | |
9f95a23c | 24 | |
7c673cae FG |
25 | dirfrag_t dirfrag; |
26 | bool last; | |
27 | ||
28 | public: | |
11fdf7f2 TL |
29 | dirfrag_t get_dirfrag() const { return dirfrag; } |
30 | bool is_last() const { return last; } | |
7c673cae | 31 | |
11fdf7f2 | 32 | protected: |
9f95a23c | 33 | MExportDirFinish() : |
f67539c2 | 34 | MMDSOp{MSG_MDS_EXPORTDIRFINISH, HEAD_VERSION, COMPAT_VERSION}, last(false) {} |
7c673cae | 35 | MExportDirFinish(dirfrag_t df, bool l, uint64_t tid) : |
f67539c2 | 36 | MMDSOp{MSG_MDS_EXPORTDIRFINISH, HEAD_VERSION, COMPAT_VERSION}, dirfrag(df), last(l) { |
7c673cae FG |
37 | set_tid(tid); |
38 | } | |
f67539c2 | 39 | ~MExportDirFinish() final {} |
7c673cae FG |
40 | |
41 | public: | |
11fdf7f2 | 42 | std::string_view get_type_name() const override { return "ExFin"; } |
f67539c2 | 43 | void print(std::ostream& o) const override { |
7c673cae FG |
44 | o << "export_finish(" << dirfrag << (last ? " last" : "") << ")"; |
45 | } | |
46 | ||
47 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
48 | using ceph::encode; |
49 | encode(dirfrag, payload); | |
50 | encode(last, payload); | |
7c673cae FG |
51 | } |
52 | void decode_payload() override { | |
f67539c2 | 53 | using ceph::decode; |
11fdf7f2 TL |
54 | auto p = payload.cbegin(); |
55 | decode(dirfrag, p); | |
56 | decode(last, p); | |
7c673cae | 57 | } |
9f95a23c TL |
58 | private: |
59 | template<class T, typename... Args> | |
60 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
61 | }; |
62 | ||
63 | #endif |