X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fmessages%2FMDirUpdate.h;fp=src%2Fceph%2Fsrc%2Fmessages%2FMDirUpdate.h;h=5752d34c68f744f29948a111532905fbe583e9ae;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/messages/MDirUpdate.h b/src/ceph/src/messages/MDirUpdate.h new file mode 100644 index 0000000..5752d34 --- /dev/null +++ b/src/ceph/src/messages/MDirUpdate.h @@ -0,0 +1,85 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2004-2006 Sage Weil + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + + +#ifndef CEPH_MDIRUPDATE_H +#define CEPH_MDIRUPDATE_H + +#include "msg/Message.h" + +class MDirUpdate : public Message { + mds_rank_t from_mds; + dirfrag_t dirfrag; + int32_t dir_rep; + int32_t discover; + compact_set dir_rep_by; + filepath path; + int tried_discover; + + public: + mds_rank_t get_source_mds() const { return from_mds; } + dirfrag_t get_dirfrag() const { return dirfrag; } + int get_dir_rep() const { return dir_rep; } + const compact_set& get_dir_rep_by() const { return dir_rep_by; } + bool should_discover() const { return discover > tried_discover; } + const filepath& get_path() const { return path; } + + bool has_tried_discover() const { return tried_discover > 0; } + void inc_tried_discover() { ++tried_discover; } + + MDirUpdate() : Message(MSG_MDS_DIRUPDATE), tried_discover(0) {} + MDirUpdate(mds_rank_t f, + dirfrag_t dirfrag, + int dir_rep, + compact_set& dir_rep_by, + filepath& path, + bool discover = false) : + Message(MSG_MDS_DIRUPDATE), tried_discover(0) { + this->from_mds = f; + this->dirfrag = dirfrag; + this->dir_rep = dir_rep; + this->dir_rep_by = dir_rep_by; + this->discover = discover ? 5 : 0; + this->path = path; + } +private: + ~MDirUpdate() override {} + +public: + const char *get_type_name() const override { return "dir_update"; } + void print(ostream& out) const override { + out << "dir_update(" << get_dirfrag() << ")"; + } + + void decode_payload() override { + bufferlist::iterator p = payload.begin(); + ::decode(from_mds, p); + ::decode(dirfrag, p); + ::decode(dir_rep, p); + ::decode(discover, p); + ::decode(dir_rep_by, p); + ::decode(path, p); + } + + void encode_payload(uint64_t features) override { + ::encode(from_mds, payload); + ::encode(dirfrag, payload); + ::encode(dir_rep, payload); + ::encode(discover, payload); + ::encode(dir_rep_by, payload); + ::encode(path, payload); + } +}; + +#endif