]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MClientCapRelease.h
import 15.2.2 octopus source
[ceph.git] / ceph / src / messages / MClientCapRelease.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 #ifndef CEPH_MCLIENTCAPRELEASE_H
16 #define CEPH_MCLIENTCAPRELEASE_H
17
18 #include "msg/Message.h"
19
20
21 class MClientCapRelease : public SafeMessage {
22 public:
23 std::string_view get_type_name() const override { return "client_cap_release";}
24 void print(ostream& out) const override {
25 out << "client_cap_release(" << caps.size() << ")";
26 }
27
28 void decode_payload() override {
29 auto p = payload.cbegin();
30 decode(head, p);
31 decode_nohead(head.num, caps, p);
32 if (header.version >= 2) {
33 decode(osd_epoch_barrier, p);
34 }
35 }
36 void encode_payload(uint64_t features) override {
37 using ceph::encode;
38 head.num = caps.size();
39 encode(head, payload);
40 encode_nohead(caps, payload);
41 encode(osd_epoch_barrier, payload);
42 }
43
44 struct ceph_mds_cap_release head;
45 vector<ceph_mds_cap_item> caps;
46
47 // The message receiver must wait for this OSD epoch
48 // before actioning this cap release.
49 epoch_t osd_epoch_barrier = 0;
50
51 private:
52 template<class T, typename... Args>
53 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
54
55 static constexpr int HEAD_VERSION = 2;
56 static constexpr int COMPAT_VERSION = 1;
57
58 MClientCapRelease() :
59 SafeMessage{CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION}
60 {
61 memset(&head, 0, sizeof(head));
62 }
63 ~MClientCapRelease() override {}
64 };
65
66 #endif