]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MExportDirDiscoverAck.h
import 15.2.2 octopus source
[ceph.git] / ceph / src / messages / MExportDirDiscoverAck.h
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_MEXPORTDIRDISCOVERACK_H
16 #define CEPH_MEXPORTDIRDISCOVERACK_H
17
18 #include "msg/Message.h"
19 #include "include/types.h"
20
21 class MExportDirDiscoverAck : public SafeMessage {
22 private:
23 static const int HEAD_VERSION = 1;
24 static const int COMPAT_VERSION = 1;
25
26 dirfrag_t dirfrag;
27 bool success;
28
29 public:
30 inodeno_t get_ino() const { return dirfrag.ino; }
31 dirfrag_t get_dirfrag() const { return dirfrag; }
32 bool is_success() const { return success; }
33
34 protected:
35 MExportDirDiscoverAck() : SafeMessage{MSG_MDS_EXPORTDIRDISCOVERACK, HEAD_VERSION, COMPAT_VERSION} {}
36 MExportDirDiscoverAck(dirfrag_t df, uint64_t tid, bool s=true) :
37 SafeMessage{MSG_MDS_EXPORTDIRDISCOVERACK, HEAD_VERSION, COMPAT_VERSION},
38 dirfrag(df), success(s) {
39 set_tid(tid);
40 }
41 ~MExportDirDiscoverAck() override {}
42
43 public:
44 std::string_view get_type_name() const override { return "ExDisA"; }
45 void print(ostream& o) const override {
46 o << "export_discover_ack(" << dirfrag;
47 if (success)
48 o << " success)";
49 else
50 o << " failure)";
51 }
52
53 void decode_payload() override {
54 auto p = payload.cbegin();
55 decode(dirfrag, p);
56 decode(success, p);
57 }
58 void encode_payload(uint64_t features) override {
59 using ceph::encode;
60 encode(dirfrag, payload);
61 encode(success, payload);
62 }
63 private:
64 template<class T, typename... Args>
65 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
66 };
67
68 #endif