]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MDentryLink.h
update sources to v12.2.5
[ceph.git] / ceph / src / messages / MDentryLink.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
16 #ifndef CEPH_MDENTRYLINK_H
17 #define CEPH_MDENTRYLINK_H
18
19 #include <boost/utility/string_view.hpp>
20
21 class MDentryLink : public Message {
22 dirfrag_t subtree;
23 dirfrag_t dirfrag;
24 string dn;
25 bool is_primary;
26
27 public:
28 dirfrag_t get_subtree() { return subtree; }
29 dirfrag_t get_dirfrag() { return dirfrag; }
30 string& get_dn() { return dn; }
31 bool get_is_primary() { return is_primary; }
32
33 bufferlist bl;
34
35 MDentryLink() :
36 Message(MSG_MDS_DENTRYLINK) { }
37 MDentryLink(dirfrag_t r, dirfrag_t df, boost::string_view n, bool p) :
38 Message(MSG_MDS_DENTRYLINK),
39 subtree(r),
40 dirfrag(df),
41 dn(n),
42 is_primary(p) {}
43 private:
44 ~MDentryLink() override {}
45
46 public:
47 const char *get_type_name() const override { return "dentry_link";}
48 void print(ostream& o) const override {
49 o << "dentry_link(" << dirfrag << " " << dn << ")";
50 }
51
52 void decode_payload() override {
53 bufferlist::iterator p = payload.begin();
54 ::decode(subtree, p);
55 ::decode(dirfrag, p);
56 ::decode(dn, p);
57 ::decode(is_primary, p);
58 ::decode(bl, p);
59 }
60 void encode_payload(uint64_t features) override {
61 ::encode(subtree, payload);
62 ::encode(dirfrag, payload);
63 ::encode(dn, payload);
64 ::encode(is_primary, payload);
65 ::encode(bl, payload);
66 }
67 };
68
69 #endif