]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MDentryLink.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MDentryLink.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_MDENTRYLINK_H
17#define CEPH_MDENTRYLINK_H
18
11fdf7f2 19#include <string_view>
94b18763 20
11fdf7f2
TL
21#include "msg/Message.h"
22
23class MDentryLink : public MessageInstance<MDentryLink> {
24public:
25 friend factory;
26private:
7c673cae
FG
27 dirfrag_t subtree;
28 dirfrag_t dirfrag;
29 string dn;
11fdf7f2 30 bool is_primary = false;
7c673cae
FG
31
32 public:
11fdf7f2
TL
33 dirfrag_t get_subtree() const { return subtree; }
34 dirfrag_t get_dirfrag() const { return dirfrag; }
35 const string& get_dn() const { return dn; }
36 bool get_is_primary() const { return is_primary; }
7c673cae
FG
37
38 bufferlist bl;
39
11fdf7f2 40protected:
7c673cae 41 MDentryLink() :
11fdf7f2
TL
42 MessageInstance(MSG_MDS_DENTRYLINK) { }
43 MDentryLink(dirfrag_t r, dirfrag_t df, std::string_view n, bool p) :
44 MessageInstance(MSG_MDS_DENTRYLINK),
7c673cae
FG
45 subtree(r),
46 dirfrag(df),
47 dn(n),
48 is_primary(p) {}
7c673cae
FG
49 ~MDentryLink() override {}
50
51public:
11fdf7f2 52 std::string_view get_type_name() const override { return "dentry_link";}
7c673cae
FG
53 void print(ostream& o) const override {
54 o << "dentry_link(" << dirfrag << " " << dn << ")";
55 }
56
57 void decode_payload() override {
11fdf7f2
TL
58 auto p = payload.cbegin();
59 decode(subtree, p);
60 decode(dirfrag, p);
61 decode(dn, p);
62 decode(is_primary, p);
63 decode(bl, p);
7c673cae
FG
64 }
65 void encode_payload(uint64_t features) override {
11fdf7f2
TL
66 using ceph::encode;
67 encode(subtree, payload);
68 encode(dirfrag, payload);
69 encode(dn, payload);
70 encode(is_primary, payload);
71 encode(bl, payload);
7c673cae
FG
72 }
73};
74
75#endif