Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / 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 class MDentryLink : public Message {
20   dirfrag_t subtree;
21   dirfrag_t dirfrag;
22   string dn;
23   bool is_primary;
24
25  public:
26   dirfrag_t get_subtree() { return subtree; }
27   dirfrag_t get_dirfrag() { return dirfrag; }
28   string& get_dn() { return dn; }
29   bool get_is_primary() { return is_primary; }
30
31   bufferlist bl;
32
33   MDentryLink() :
34     Message(MSG_MDS_DENTRYLINK) { }
35   MDentryLink(dirfrag_t r, dirfrag_t df, string& n, bool p) :
36     Message(MSG_MDS_DENTRYLINK),
37     subtree(r),
38     dirfrag(df),
39     dn(n),
40     is_primary(p) {}
41 private:
42   ~MDentryLink() override {}
43
44 public:
45   const char *get_type_name() const override { return "dentry_link";}
46   void print(ostream& o) const override {
47     o << "dentry_link(" << dirfrag << " " << dn << ")";
48   }
49   
50   void decode_payload() override {
51     bufferlist::iterator p = payload.begin();
52     ::decode(subtree, p);
53     ::decode(dirfrag, p);
54     ::decode(dn, p);
55     ::decode(is_primary, p);
56     ::decode(bl, p);
57   }
58   void encode_payload(uint64_t features) override {
59     ::encode(subtree, payload);
60     ::encode(dirfrag, payload);
61     ::encode(dn, payload);
62     ::encode(is_primary, payload);
63     ::encode(bl, payload);
64   }
65 };
66
67 #endif