]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMDSFragmentNotify.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_MMDSFRAGMENTNOTIFY_H
16 #define CEPH_MMDSFRAGMENTNOTIFY_H
18 #include "messages/MMDSOp.h"
20 class MMDSFragmentNotify final
: public MMDSOp
{
22 static constexpr int HEAD_VERSION
= 2;
23 static constexpr int COMPAT_VERSION
= 1;
25 dirfrag_t base_dirfrag
;
27 bool ack_wanted
= false;
30 inodeno_t
get_ino() const { return base_dirfrag
.ino
; }
31 frag_t
get_basefrag() const { return base_dirfrag
.frag
; }
32 dirfrag_t
get_base_dirfrag() const { return base_dirfrag
; }
33 int get_bits() const { return bits
; }
34 bool is_ack_wanted() const { return ack_wanted
; }
35 void mark_ack_wanted() { ack_wanted
= true; }
37 ceph::buffer::list basebl
;
40 MMDSFragmentNotify() :
41 MMDSOp
{MSG_MDS_FRAGMENTNOTIFY
, HEAD_VERSION
, COMPAT_VERSION
} {}
42 MMDSFragmentNotify(dirfrag_t df
, int b
, uint64_t tid
) :
43 MMDSOp
{MSG_MDS_FRAGMENTNOTIFY
, HEAD_VERSION
, COMPAT_VERSION
},
44 base_dirfrag(df
), bits(b
) {
47 ~MMDSFragmentNotify() final
{}
50 std::string_view
get_type_name() const override
{ return "fragment_notify"; }
51 void print(std::ostream
& o
) const override
{
52 o
<< "fragment_notify(" << base_dirfrag
<< " " << (int)bits
<< ")";
55 void encode_payload(uint64_t features
) override
{
57 encode(base_dirfrag
, payload
);
58 encode(bits
, payload
);
59 encode(basebl
, payload
);
60 encode(ack_wanted
, payload
);
62 void decode_payload() override
{
64 auto p
= payload
.cbegin();
65 decode(base_dirfrag
, p
);
68 if (header
.version
>= 2)
69 decode(ack_wanted
, p
);
72 template<class T
, typename
... Args
>
73 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);