]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MFSMap.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MFSMap.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
16 #ifndef CEPH_MFSMAP_H
17 #define CEPH_MFSMAP_H
18
19 #include "msg/Message.h"
20 #include "mds/FSMap.h"
21 #include "include/ceph_features.h"
22
23 class MFSMap : public MessageInstance<MFSMap> {
24 public:
25 friend factory;
26
27 epoch_t epoch;
28 bufferlist encoded;
29
30 version_t get_epoch() const { return epoch; }
31 const FSMap& get_fsmap() const {return fsmap;}
32
33 MFSMap() :
34 MessageInstance(CEPH_MSG_FS_MAP), epoch(0) {}
35 MFSMap(const uuid_d &f, const FSMap &fsmap_) :
36 MessageInstance(CEPH_MSG_FS_MAP), epoch(fsmap_.get_epoch())
37 {
38 fsmap = fsmap_;
39 }
40 private:
41 FSMap fsmap;
42
43 ~MFSMap() override {}
44
45 public:
46 std::string_view get_type_name() const override { return "fsmap"; }
47 void print(ostream& out) const override {
48 out << "fsmap(e " << epoch << ")";
49 }
50
51 // marshalling
52 void decode_payload() override {
53 auto p = payload.cbegin();
54 decode(epoch, p);
55 decode(fsmap, p);
56 }
57 void encode_payload(uint64_t features) override {
58 using ceph::encode;
59 encode(epoch, payload);
60 encode(fsmap, payload, features);
61 }
62 };
63
64 #endif