Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / mds / events / EExport.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_EEXPORT_H
16 #define CEPH_EEXPORT_H
17
18 #include "common/config.h"
19 #include "include/types.h"
20
21 #include "../MDSRank.h"
22
23 #include "EMetaBlob.h"
24 #include "../LogEvent.h"
25
26 class EExport : public LogEvent {
27 public:
28   EMetaBlob metablob; // exported dir
29 protected:
30   dirfrag_t      base;
31   set<dirfrag_t> bounds;
32   mds_rank_t target;
33   
34 public:
35   EExport() :
36     LogEvent(EVENT_EXPORT), target(MDS_RANK_NONE) { }
37   EExport(MDLog *mdlog, CDir *dir, mds_rank_t t) :
38     LogEvent(EVENT_EXPORT), metablob(mdlog),
39     base(dir->dirfrag()), target(t) { }
40   
41   set<dirfrag_t> &get_bounds() { return bounds; }
42   
43   void print(ostream& out) const override {
44     out << "EExport " << base << " to mds." << target << " " << metablob;
45   }
46
47   EMetaBlob *get_metablob() override { return &metablob; }
48
49   void encode(bufferlist& bl, uint64_t features) const override;
50   void decode(bufferlist::iterator &bl) override;
51   void dump(Formatter *f) const override;
52   static void generate_test_instances(list<EExport*>& ls);
53   void replay(MDSRank *mds) override;
54
55 };
56 WRITE_CLASS_ENCODER_FEATURES(EExport)
57
58 #endif