]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MLog.h
bump version to 18.2.2-pve1
[ceph.git] / 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 final : 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, std::deque<LogEntry>&& e)
30 : PaxosServiceMessage{MSG_LOG, 0}, fsid(f), entries{std::move(e)} { }
31 MLog(const uuid_d& f) : PaxosServiceMessage(MSG_LOG, 0), fsid(f) { }
32 private:
33 ~MLog() final {}
34
35 public:
36 std::string_view get_type_name() const override { return "log"; }
37 void print(std::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 using ceph::encode;
47 paxos_encode();
48 encode(fsid, payload);
49 encode(entries, payload, features);
50 }
51 void decode_payload() override {
52 using ceph::decode;
53 auto p = payload.cbegin();
54 paxos_decode(p);
55 decode(fsid, p);
56 decode(entries, p);
57 }
58 };
59
60 #endif