]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGNotify.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.
15 #ifndef CEPH_MOSDPGPEERNOTIFY_H
16 #define CEPH_MOSDPGPEERNOTIFY_H
18 #include "msg/Message.h"
20 #include "osd/osd_types.h"
23 * PGNotify - notify primary of my PGs and versions.
26 class MOSDPGNotify final
: public Message
{
28 static constexpr int HEAD_VERSION
= 7;
29 static constexpr int COMPAT_VERSION
= 7;
32 /// query_epoch is the epoch of the query being responded to, or
33 /// the current epoch if this is not being sent in response to a
34 /// query. This allows the recipient to disregard responses to old
36 using pg_list_t
= std::vector
<pg_notify_t
>;
40 version_t
get_epoch() const { return epoch
; }
41 const pg_list_t
& get_pg_list() const {
48 MOSDPGNotify(epoch_t e
, pg_list_t
&& l
)
49 : Message
{MSG_OSD_PG_NOTIFY
, HEAD_VERSION
, COMPAT_VERSION
},
51 pg_list(std::move(l
)) {
52 set_priority(CEPH_MSG_PRIO_HIGH
);
55 ~MOSDPGNotify() final
{}
58 std::string_view
get_type_name() const override
{ return "PGnot"; }
60 void encode_payload(uint64_t features
) override
{
62 header
.version
= HEAD_VERSION
;
63 encode(epoch
, payload
);
64 assert(HAVE_FEATURE(features
, SERVER_OCTOPUS
));
65 encode(pg_list
, payload
);
68 void decode_payload() override
{
69 auto p
= payload
.cbegin();
74 void print(std::ostream
& out
) const override
{
76 for (auto i
= pg_list
.begin();
79 if (i
!= pg_list
.begin())
83 out
<< " epoch " << epoch
87 template<class T
, typename
... Args
>
88 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);