Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MMDSFragmentNotify.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_MMDSFRAGMENTNOTIFY_H
16 #define CEPH_MMDSFRAGMENTNOTIFY_H
17
18 #include "msg/Message.h"
19
20 class MMDSFragmentNotify : public Message {
21   inodeno_t ino;
22   frag_t basefrag;
23   int8_t bits;
24
25  public:
26   inodeno_t get_ino() { return ino; }
27   frag_t get_basefrag() { return basefrag; }
28   int get_bits() { return bits; }
29
30   bufferlist basebl;
31
32   MMDSFragmentNotify() : Message(MSG_MDS_FRAGMENTNOTIFY) {}
33   MMDSFragmentNotify(dirfrag_t df, int b) :
34         Message(MSG_MDS_FRAGMENTNOTIFY),
35     ino(df.ino), basefrag(df.frag), bits(b) { }
36 private:
37   ~MMDSFragmentNotify() override {}
38
39 public:  
40   const char *get_type_name() const override { return "fragment_notify"; }
41   void print(ostream& o) const override {
42     o << "fragment_notify(" << ino << "." << basefrag
43       << " " << (int)bits << ")";
44   }
45
46   void encode_payload(uint64_t features) override {
47     ::encode(ino, payload);
48     ::encode(basefrag, payload);
49     ::encode(bits, payload);
50     ::encode(basebl, payload);
51   }
52   void decode_payload() override {
53     bufferlist::iterator p = payload.begin();
54     ::decode(ino, p);
55     ::decode(basefrag, p);
56     ::decode(bits, p);
57     ::decode(basebl, p);
58   }
59   
60 };
61
62 #endif