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_MPOOLOP_H
16 #define CEPH_MPOOLOP_H
18 #include "messages/PaxosServiceMessage.h"
21 class MPoolOp : public PaxosServiceMessage {
23 static const int HEAD_VERSION = 4;
24 static const int COMPAT_VERSION = 2;
36 : PaxosServiceMessage(CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION) { }
37 MPoolOp(const uuid_d& f, ceph_tid_t t, int p, string& n, int o, version_t v)
38 : PaxosServiceMessage(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION),
39 fsid(f), pool(p), name(n), op(o),
40 auid(0), snapid(0), crush_rule(0) {
43 MPoolOp(const uuid_d& f, ceph_tid_t t, int p, string& n,
44 int o, uint64_t uid, version_t v)
45 : PaxosServiceMessage(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION),
46 fsid(f), pool(p), name(n), op(o),
47 auid(uid), snapid(0), crush_rule(0) {
52 ~MPoolOp() override {}
55 const char *get_type_name() const override { return "poolop"; }
56 void print(ostream& out) const override {
57 out << "pool_op(" << ceph_pool_op_name(op) << " pool " << pool
59 << " tid " << get_tid()
61 << " v" << version << ")";
64 void encode_payload(uint64_t features) override {
66 ::encode(fsid, payload);
67 ::encode(pool, payload);
68 ::encode(op, payload);
69 ::encode(auid, payload);
70 ::encode(snapid, payload);
71 ::encode(name, payload);
73 ::encode(pad, payload); /* for v3->v4 encoding change */
74 ::encode(crush_rule, payload);
76 void decode_payload() override {
77 bufferlist::iterator p = payload.begin();
81 if (header.version < 2)
86 if (header.version >= 2)
89 if (header.version >= 3) {
92 if (header.version >= 4)
93 ::decode(crush_rule, p);