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_MCLIENTCAPRELEASE_H
16 #define CEPH_MCLIENTCAPRELEASE_H
18 #include "msg/Message.h"
21 class MClientCapRelease final
: public SafeMessage
{
23 std::string_view
get_type_name() const override
{ return "client_cap_release";}
24 void print(std::ostream
& out
) const override
{
25 out
<< "client_cap_release(" << caps
.size() << ")";
28 void decode_payload() override
{
30 auto p
= payload
.cbegin();
32 ceph::decode_nohead(head
.num
, caps
, p
);
33 if (header
.version
>= 2) {
34 decode(osd_epoch_barrier
, p
);
37 void encode_payload(uint64_t features
) override
{
39 head
.num
= caps
.size();
40 encode(head
, payload
);
41 ceph::encode_nohead(caps
, payload
);
42 encode(osd_epoch_barrier
, payload
);
45 struct ceph_mds_cap_release head
;
46 std::vector
<ceph_mds_cap_item
> caps
;
48 // The message receiver must wait for this OSD epoch
49 // before actioning this cap release.
50 epoch_t osd_epoch_barrier
= 0;
53 template<class T
, typename
... Args
>
54 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);
55 template<class T
, typename
... Args
>
56 friend MURef
<T
> crimson::make_message(Args
&&... args
);
58 static constexpr int HEAD_VERSION
= 2;
59 static constexpr int COMPAT_VERSION
= 1;
62 SafeMessage
{CEPH_MSG_CLIENT_CAPRELEASE
, HEAD_VERSION
, COMPAT_VERSION
}
64 memset(&head
, 0, sizeof(head
));
66 ~MClientCapRelease() final
{}