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) 2013 Inktank, Inc.
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.
13 #ifndef CEPH_MMONSCRUB_H
14 #define CEPH_MMONSCRUB_H
16 #include "msg/Message.h"
17 #include "mon/mon_types.h"
19 class MMonScrub : public Message
21 static const int HEAD_VERSION = 2;
22 static const int COMPAT_VERSION = 2;
26 OP_SCRUB = 1, // leader->peon: scrub (a range of) keys
27 OP_RESULT = 2, // peon->leader: result of a scrub
30 static const char *get_opname(op_type_t op) {
32 case OP_SCRUB: return "scrub";
33 case OP_RESULT: return "result";
34 default: assert(0 == "unknown op type"); return NULL;
42 pair<string,string> key;
45 : Message(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION),
49 MMonScrub(op_type_t op, version_t v, int32_t num_keys)
50 : Message(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION),
51 op(op), version(v), num_keys(num_keys)
54 const char *get_type_name() const override { return "mon_scrub"; }
56 void print(ostream& out) const override {
57 out << "mon_scrub(" << get_opname((op_type_t)op);
58 out << " v " << version;
61 out << " num_keys " << num_keys;
62 out << " key (" << key << ")";
66 void encode_payload(uint64_t features) override {
69 ::encode(version, payload);
70 ::encode(result, payload);
71 ::encode(num_keys, payload);
72 ::encode(key, payload);
75 void decode_payload() override {
76 bufferlist::iterator p = payload.begin();
82 ::decode(num_keys, p);
87 #endif /* CEPH_MMONSCRUB_H */