]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MDiscover.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.
16 #ifndef CEPH_MDISCOVER_H
17 #define CEPH_MDISCOVER_H
19 #include "msg/Message.h"
20 #include "include/filepath.h"
25 class MDiscover
: public MessageInstance
<MDiscover
> {
30 inodeno_t base_ino
; // 1 -> root
34 filepath want
; // ... [/]need/this/stuff
36 bool want_base_dir
= true;
37 bool want_xlocked
= false;
40 inodeno_t
get_base_ino() const { return base_ino
; }
41 frag_t
get_base_dir_frag() const { return base_dir_frag
; }
42 snapid_t
get_snapid() const { return snapid
; }
44 const filepath
& get_want() const { return want
; }
45 const std::string
& get_dentry(int n
) const { return want
[n
]; }
47 bool wants_base_dir() const { return want_base_dir
; }
48 bool wants_xlocked() const { return want_xlocked
; }
50 void set_base_dir_frag(frag_t f
) { base_dir_frag
= f
; }
53 MDiscover() : MessageInstance(MSG_MDS_DISCOVER
) { }
54 MDiscover(inodeno_t base_ino_
,
58 bool want_base_dir_
= true,
59 bool discover_xlocks_
= false) :
60 MessageInstance(MSG_MDS_DISCOVER
),
62 base_dir_frag(base_frag_
),
65 want_base_dir(want_base_dir_
),
66 want_xlocked(discover_xlocks_
) { }
67 ~MDiscover() override
{}
70 std::string_view
get_type_name() const override
{ return "Dis"; }
71 void print(ostream
&out
) const override
{
72 out
<< "discover(" << header
.tid
<< " " << base_ino
<< "." << base_dir_frag
73 << " " << want
<< ")";
76 void decode_payload() override
{
77 auto p
= payload
.cbegin();
79 decode(base_dir_frag
, p
);
82 decode(want_base_dir
, p
);
83 decode(want_xlocked
, p
);
85 void encode_payload(uint64_t features
) override
{
87 encode(base_ino
, payload
);
88 encode(base_dir_frag
, payload
);
89 encode(snapid
, payload
);
90 encode(want
, payload
);
91 encode(want_base_dir
, payload
);
92 encode(want_xlocked
, payload
);