]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MDirUpdate.h
e282b04d386d0dc19b95e7b7682ce7aea85838d9
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_MDIRUPDATE_H
17 #define CEPH_MDIRUPDATE_H
19 #include "msg/Message.h"
21 class MDirUpdate
: public Message
{
26 compact_set
<int32_t> dir_rep_by
;
30 mds_rank_t
get_source_mds() const { return from_mds
; }
31 dirfrag_t
get_dirfrag() const { return dirfrag
; }
32 int get_dir_rep() const { return dir_rep
; }
33 const compact_set
<int>& get_dir_rep_by() const { return dir_rep_by
; }
34 bool should_discover() const { return discover
> 0; }
35 const filepath
& get_path() const { return path
; }
37 void tried_discover() {
38 if (discover
) discover
--;
41 MDirUpdate() : Message(MSG_MDS_DIRUPDATE
) {}
42 MDirUpdate(mds_rank_t f
,
45 compact_set
<int>& dir_rep_by
,
47 bool discover
= false) :
48 Message(MSG_MDS_DIRUPDATE
) {
50 this->dirfrag
= dirfrag
;
51 this->dir_rep
= dir_rep
;
52 this->dir_rep_by
= dir_rep_by
;
53 if (discover
) this->discover
= 5;
54 else this->discover
= 0;
58 ~MDirUpdate() override
{}
61 const char *get_type_name() const override
{ return "dir_update"; }
62 void print(ostream
& out
) const override
{
63 out
<< "dir_update(" << get_dirfrag() << ")";
66 void decode_payload() override
{
67 bufferlist::iterator p
= payload
.begin();
68 ::decode(from_mds
, p
);
71 ::decode(discover
, p
);
72 ::decode(dir_rep_by
, p
);
76 void encode_payload(uint64_t features
) override
{
77 ::encode(from_mds
, payload
);
78 ::encode(dirfrag
, payload
);
79 ::encode(dir_rep
, payload
);
80 ::encode(discover
, payload
);
81 ::encode(dir_rep_by
, payload
);
82 ::encode(path
, payload
);