Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MLog.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_MLOG_H
16 #define CEPH_MLOG_H
17
18 #include "common/LogEntry.h"
19 #include "messages/PaxosServiceMessage.h"
20
21 #include <deque>
22
23 class MLog : public PaxosServiceMessage {
24 public:
25   uuid_d fsid;
26   std::deque<LogEntry> entries;
27   
28   MLog() : PaxosServiceMessage(MSG_LOG, 0) {}
29   MLog(const uuid_d& f, const std::deque<LogEntry>& e)
30     : PaxosServiceMessage(MSG_LOG, 0), fsid(f), entries(e) { }
31   MLog(const uuid_d& f) : PaxosServiceMessage(MSG_LOG, 0), fsid(f) { }
32 private:
33   ~MLog() override {}
34
35 public:
36   const char *get_type_name() const override { return "log"; }
37   void print(ostream& out) const override {
38     out << "log(";
39     if (entries.size())
40       out << entries.size() << " entries from seq " << entries.front().seq
41           << " at " << entries.front().stamp;
42     out << ")";
43   }
44
45   void encode_payload(uint64_t features) override {
46     paxos_encode();
47     ::encode(fsid, payload);
48     ::encode(entries, payload, features);
49   }
50   void decode_payload() override {
51     bufferlist::iterator p = payload.begin();
52     paxos_decode(p);
53     ::decode(fsid, p);
54     ::decode(entries, p);
55   }
56 };
57
58 #endif