]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MDentryUnlink.h
210fa033c5219219616129d053795862df0b5768
[ceph.git] / ceph / src / messages / MDentryUnlink.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
16 #ifndef CEPH_MDENTRYUNLINK_H
17 #define CEPH_MDENTRYUNLINK_H
18
19 #include <string_view>
20
21 #include "messages/MMDSOp.h"
22
23 class MDentryUnlink final : public MMDSOp {
24 private:
25 static constexpr int HEAD_VERSION = 1;
26 static constexpr int COMPAT_VERSION = 1;
27
28 dirfrag_t dirfrag;
29 std::string dn;
30
31 public:
32 dirfrag_t get_dirfrag() const { return dirfrag; }
33 const std::string& get_dn() const { return dn; }
34
35 ceph::buffer::list straybl;
36 ceph::buffer::list snapbl;
37
38 protected:
39 MDentryUnlink() :
40 MMDSOp(MSG_MDS_DENTRYUNLINK, HEAD_VERSION, COMPAT_VERSION) { }
41 MDentryUnlink(dirfrag_t df, std::string_view n) :
42 MMDSOp(MSG_MDS_DENTRYUNLINK, HEAD_VERSION, COMPAT_VERSION),
43 dirfrag(df),
44 dn(n) {}
45 ~MDentryUnlink() final {}
46
47 public:
48 std::string_view get_type_name() const override { return "dentry_unlink";}
49 void print(std::ostream& o) const override {
50 o << "dentry_unlink(" << dirfrag << " " << dn << ")";
51 }
52
53 void decode_payload() override {
54 using ceph::decode;
55 auto p = payload.cbegin();
56 decode(dirfrag, p);
57 decode(dn, p);
58 decode(straybl, p);
59 }
60 void encode_payload(uint64_t features) override {
61 using ceph::encode;
62 encode(dirfrag, payload);
63 encode(dn, payload);
64 encode(straybl, payload);
65 }
66 private:
67 template<class T, typename... Args>
68 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
69 template<class T, typename... Args>
70 friend MURef<T> crimson::make_message(Args&&... args);
71 };
72
73 #endif