]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MExportDirNotify.h
update sources to 12.2.7
[ceph.git] / ceph / src / messages / MExportDirNotify.h
CommitLineData
7c673cae
FG
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#ifndef CEPH_MEXPORTDIRNOTIFY_H
16#define CEPH_MEXPORTDIRNOTIFY_H
17
18#include "msg/Message.h"
19
20class MExportDirNotify : public Message {
21 dirfrag_t base;
22 bool ack;
23 pair<__s32,__s32> old_auth, new_auth;
24 list<dirfrag_t> bounds; // bounds; these dirs are _not_ included (tho the dirfragdes are)
25
26 public:
27 dirfrag_t get_dirfrag() { return base; }
28 pair<__s32,__s32> get_old_auth() { return old_auth; }
29 pair<__s32,__s32> get_new_auth() { return new_auth; }
30 bool wants_ack() { return ack; }
31 list<dirfrag_t>& get_bounds() { return bounds; }
32
33 MExportDirNotify() {}
34 MExportDirNotify(dirfrag_t i, uint64_t tid, bool a, pair<__s32,__s32> oa, pair<__s32,__s32> na) :
35 Message(MSG_MDS_EXPORTDIRNOTIFY),
36 base(i), ack(a), old_auth(oa), new_auth(na) {
37 set_tid(tid);
38 }
39private:
40 ~MExportDirNotify() override {}
41
42public:
43 const char *get_type_name() const override { return "ExNot"; }
44 void print(ostream& o) const override {
45 o << "export_notify(" << base;
46 o << " " << old_auth << " -> " << new_auth;
47 if (ack)
48 o << " ack)";
49 else
50 o << " no ack)";
51 }
52
53 void copy_bounds(list<dirfrag_t>& ex) {
54 this->bounds = ex;
55 }
56 void copy_bounds(set<dirfrag_t>& ex) {
57 for (set<dirfrag_t>::iterator i = ex.begin();
58 i != ex.end(); ++i)
59 bounds.push_back(*i);
60 }
61
62 void encode_payload(uint64_t features) override {
63 ::encode(base, payload);
64 ::encode(ack, payload);
65 ::encode(old_auth, payload);
66 ::encode(new_auth, payload);
67 ::encode(bounds, payload);
68 }
69 void decode_payload() override {
70 bufferlist::iterator p = payload.begin();
71 ::decode(base, p);
72 ::decode(ack, p);
73 ::decode(old_auth, p);
74 ::decode(new_auth, p);
75 ::decode(bounds, p);
76 }
77};
78
79#endif