]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MExportDirDiscover.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / messages / MExportDirDiscover.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#ifndef CEPH_MEXPORTDIRDISCOVER_H
16#define CEPH_MEXPORTDIRDISCOVER_H
17
18#include "msg/Message.h"
19#include "include/types.h"
20
9f95a23c 21class MExportDirDiscover : public SafeMessage {
11fdf7f2 22private:
9f95a23c
TL
23 static const int HEAD_VERSION = 1;
24 static const int COMPAT_VERSION = 1;
11fdf7f2 25 mds_rank_t from = -1;
7c673cae
FG
26 dirfrag_t dirfrag;
27 filepath path;
28
29 public:
11fdf7f2
TL
30 mds_rank_t get_source_mds() const { return from; }
31 inodeno_t get_ino() const { return dirfrag.ino; }
32 dirfrag_t get_dirfrag() const { return dirfrag; }
33 const filepath& get_path() const { return path; }
7c673cae
FG
34
35 bool started;
36
11fdf7f2 37protected:
7c673cae 38 MExportDirDiscover() :
9f95a23c 39 SafeMessage{MSG_MDS_EXPORTDIRDISCOVER, HEAD_VERSION, COMPAT_VERSION},
7c673cae
FG
40 started(false) { }
41 MExportDirDiscover(dirfrag_t df, filepath& p, mds_rank_t f, uint64_t tid) :
9f95a23c 42 SafeMessage{MSG_MDS_EXPORTDIRDISCOVER, HEAD_VERSION, COMPAT_VERSION},
7c673cae
FG
43 from(f), dirfrag(df), path(p), started(false) {
44 set_tid(tid);
45 }
7c673cae
FG
46 ~MExportDirDiscover() override {}
47
48public:
11fdf7f2 49 std::string_view get_type_name() const override { return "ExDis"; }
7c673cae
FG
50 void print(ostream& o) const override {
51 o << "export_discover(" << dirfrag << " " << path << ")";
52 }
53
54 void decode_payload() override {
11fdf7f2
TL
55 auto p = payload.cbegin();
56 decode(from, p);
57 decode(dirfrag, p);
58 decode(path, p);
7c673cae
FG
59 }
60
61 void encode_payload(uint64_t features) override {
11fdf7f2
TL
62 using ceph::encode;
63 encode(from, payload);
64 encode(dirfrag, payload);
65 encode(path, payload);
7c673cae 66 }
9f95a23c
TL
67private:
68 template<class T, typename... Args>
69 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
70};
71
72#endif