]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MExportDirPrep.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MExportDirPrep.h
CommitLineData
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
16#ifndef CEPH_MEXPORTDIRPREP_H
17#define CEPH_MEXPORTDIRPREP_H
18
7c673cae 19#include "include/types.h"
f67539c2 20#include "messages/MMDSOp.h"
7c673cae 21
f67539c2 22class MExportDirPrep final : public MMDSOp {
11fdf7f2 23private:
f67539c2
TL
24 static constexpr int HEAD_VERSION = 1;
25 static constexpr int COMPAT_VERSION = 1;
9f95a23c 26
7c673cae 27 dirfrag_t dirfrag;
f67539c2
TL
28public:
29 ceph::buffer::list basedir;
30 std::list<dirfrag_t> bounds;
31 std::list<ceph::buffer::list> traces;
7c673cae 32private:
f67539c2 33 std::set<mds_rank_t> bystanders;
9f95a23c 34 bool b_did_assim = false;
7c673cae
FG
35
36public:
11fdf7f2 37 dirfrag_t get_dirfrag() const { return dirfrag; }
f67539c2
TL
38 const std::list<dirfrag_t>& get_bounds() const { return bounds; }
39 const std::set<mds_rank_t> &get_bystanders() const { return bystanders; }
7c673cae 40
11fdf7f2 41 bool did_assim() const { return b_did_assim; }
7c673cae
FG
42 void mark_assim() { b_did_assim = true; }
43
11fdf7f2 44protected:
9f95a23c 45 MExportDirPrep() = default;
7c673cae 46 MExportDirPrep(dirfrag_t df, uint64_t tid) :
f67539c2 47 MMDSOp{MSG_MDS_EXPORTDIRPREP, HEAD_VERSION, COMPAT_VERSION},
9f95a23c
TL
48 dirfrag(df)
49 {
7c673cae
FG
50 set_tid(tid);
51 }
f67539c2 52 ~MExportDirPrep() final {}
7c673cae
FG
53
54public:
11fdf7f2 55 std::string_view get_type_name() const override { return "ExP"; }
f67539c2 56 void print(std::ostream& o) const override {
7c673cae
FG
57 o << "export_prep(" << dirfrag << ")";
58 }
59
60 void add_bound(dirfrag_t df) {
61 bounds.push_back( df );
62 }
f67539c2 63 void add_trace(ceph::buffer::list& bl) {
7c673cae
FG
64 traces.push_back(bl);
65 }
66 void add_bystander(mds_rank_t who) {
67 bystanders.insert(who);
68 }
69
70 void decode_payload() override {
11fdf7f2
TL
71 using ceph::decode;
72 auto p = payload.cbegin();
73 decode(dirfrag, p);
74 decode(basedir, p);
75 decode(bounds, p);
76 decode(traces, p);
77 decode(bystanders, p);
7c673cae
FG
78 }
79
80 void encode_payload(uint64_t features) override {
11fdf7f2
TL
81 using ceph::encode;
82 encode(dirfrag, payload);
83 encode(basedir, payload);
84 encode(bounds, payload);
85 encode(traces, payload);
86 encode(bystanders, payload);
7c673cae 87 }
9f95a23c
TL
88private:
89 template<class T, typename... Args>
90 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
91};
92
93#endif