summaryrefslogtreecommitdiffstats
path: root/src/messages/MOSDRepScrub.h
blob: 7599771f48031ed73d86f14d4ac9942b04a9b5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// -*- 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 <sage@newdream.net>
 *
 * 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_MOSDREPSCRUB_H
#define CEPH_MOSDREPSCRUB_H

#include "msg/Message.h"

/*
 * instruct an OSD initiate a replica scrub on a specific PG
 */

struct MOSDRepScrub : public Message {
  pg_t pgid;             // PG to scrub
  eversion_t scrub_from; // only scrub log entries after scrub_from
  eversion_t scrub_to;   // last_update_applied when message sent
  epoch_t map_epoch;

  MOSDRepScrub() {}
  MOSDRepScrub(pg_t pgid, eversion_t scrub_from, eversion_t scrub_to,
	       epoch_t map_epoch) :
    Message(MSG_OSD_REP_SCRUB),
    pgid(pgid),
    scrub_from(scrub_from),
    scrub_to(scrub_to),
    map_epoch(map_epoch) {}
  
private:
  ~MOSDRepScrub() {}

public:
  const char *get_type_name() { return "replica scrub"; }
  void print(ostream& out) {
    out << "replica scrub(pg: ";
    out << pgid << ",from:" << scrub_from << ",to:" << scrub_to
	<< "epoch:" << map_epoch;
    out << ")";
  }

  void encode_payload(CephContext *cct, uint64_t features) {
    header.version = 2;
    ::encode(pgid, payload);
    ::encode(scrub_from, payload);
    ::encode(scrub_to, payload);
    ::encode(map_epoch, payload);
  }
  void decode_payload(CephContext *cct) {
    assert(header.version == 2);
    bufferlist::iterator p = payload.begin();
    ::decode(pgid, p);
    ::decode(scrub_from, p);
    ::decode(scrub_to, p);
    ::decode(map_epoch, p);
  }
};

#endif