]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMDSMap.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef CEPH_MMDSMAP_H
17 #define CEPH_MMDSMAP_H
19 #include "msg/Message.h"
20 #include "mds/MDSMap.h"
21 #include "include/ceph_features.h"
23 class MMDSMap final
: public SafeMessage
{
25 static constexpr int HEAD_VERSION
= 2;
26 static constexpr int COMPAT_VERSION
= 1;
30 ceph::buffer::list encoded
;
31 // don't really need map_fs_name. it was accidentally added in 51af2346fdf
32 // set it to empty string.
33 std::string map_fs_name
= std::string();
35 version_t
get_epoch() const { return epoch
; }
36 const ceph::buffer::list
& get_encoded() const { return encoded
; }
40 SafeMessage
{CEPH_MSG_MDS_MAP
, HEAD_VERSION
, COMPAT_VERSION
} {}
42 MMDSMap(const uuid_d
&f
, const MDSMap
&mm
) :
43 SafeMessage
{CEPH_MSG_MDS_MAP
, HEAD_VERSION
, COMPAT_VERSION
},
45 epoch
= mm
.get_epoch();
46 mm
.encode(encoded
, -1); // we will reencode with fewer features as necessary
52 std::string_view
get_type_name() const override
{ return "mdsmap"; }
53 void print(std::ostream
& out
) const override
{
54 out
<< "mdsmap(e " << epoch
<< ")";
58 void decode_payload() override
{
60 auto p
= payload
.cbegin();
64 if (header
.version
>= 2) {
65 decode(map_fs_name
, p
);
68 void encode_payload(uint64_t features
) override
{
70 encode(fsid
, payload
);
71 encode(epoch
, payload
);
72 if ((features
& CEPH_FEATURE_PGID64
) == 0 ||
73 (features
& CEPH_FEATURE_MDSENC
) == 0 ||
74 (features
& CEPH_FEATURE_MSG_ADDR2
) == 0 ||
75 !HAVE_FEATURE(features
, SERVER_NAUTILUS
)) {
76 // reencode for old clients.
80 m
.encode(encoded
, features
);
82 encode(encoded
, payload
);
83 encode(map_fs_name
, payload
);
86 template<class T
, typename
... Args
>
87 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);
88 template<class T
, typename
... Args
>
89 friend MURef
<T
> crimson::make_message(Args
&&... args
);