]>
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
: public Message
{
24 static const int HEAD_VERSION
= 1;
25 static const int COMPAT_VERSION
= 1;
32 version_t
get_epoch() const { return epoch
; }
33 bufferlist
& get_encoded() { return encoded
; }
36 Message(CEPH_MSG_MDS_MAP
, HEAD_VERSION
, COMPAT_VERSION
) {}
37 MMDSMap(const uuid_d
&f
, const MDSMap
*mm
) :
38 Message(CEPH_MSG_MDS_MAP
, HEAD_VERSION
, COMPAT_VERSION
),
40 epoch
= mm
->get_epoch();
41 mm
->encode(encoded
, -1); // we will reencode with fewer features as necessary
44 ~MMDSMap() override
{}
47 const char *get_type_name() const override
{ return "mdsmap"; }
48 void print(ostream
& out
) const override
{
49 out
<< "mdsmap(e " << epoch
<< ")";
53 void decode_payload() override
{
54 bufferlist::iterator p
= payload
.begin();
59 void encode_payload(uint64_t features
) override
{
60 ::encode(fsid
, payload
);
61 ::encode(epoch
, payload
);
62 if ((features
& CEPH_FEATURE_PGID64
) == 0 ||
63 (features
& CEPH_FEATURE_MDSENC
) == 0 ||
64 (features
& CEPH_FEATURE_MSG_ADDR2
) == 0) {
65 // reencode for old clients.
69 m
.encode(encoded
, features
);
71 ::encode(encoded
, payload
);