Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / mds / events / ETableServer.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_MDS_ETABLESERVER_H
16 #define CEPH_MDS_ETABLESERVER_H
17
18 #include "common/config.h"
19 #include "include/types.h"
20
21 #include "../mds_table_types.h"
22 #include "../LogEvent.h"
23
24 struct ETableServer : public LogEvent {
25   __u16 table;
26   __s16 op;
27   uint64_t reqid;
28   mds_rank_t bymds;
29   bufferlist mutation;
30   version_t tid;
31   version_t version;
32
33   ETableServer() : LogEvent(EVENT_TABLESERVER), table(0), op(0),
34                    reqid(0), bymds(MDS_RANK_NONE), tid(0), version(0) { }
35   ETableServer(int t, int o, uint64_t ri, mds_rank_t m, version_t ti, version_t v) :
36     LogEvent(EVENT_TABLESERVER),
37     table(t), op(o), reqid(ri), bymds(m), tid(ti), version(v) { }
38
39   void encode(bufferlist& bl, uint64_t features) const override;
40   void decode(bufferlist::iterator& bl) override;
41   void dump(Formatter *f) const override;
42   static void generate_test_instances(list<ETableServer*>& ls);
43
44   void print(ostream& out) const override {
45     out << "ETableServer " << get_mdstable_name(table) 
46         << " " << get_mdstableserver_opname(op);
47     if (reqid) out << " reqid " << reqid;
48     if (bymds >= 0) out << " mds." << bymds;
49     if (tid) out << " tid " << tid;
50     if (version) out << " version " << version;
51     if (mutation.length()) out << " mutation=" << mutation.length() << " bytes";
52   }  
53
54   void update_segment() override;
55   void replay(MDSRank *mds) override;  
56 };
57 WRITE_CLASS_ENCODER_FEATURES(ETableServer)
58
59 #endif