~mathiaz/+junk/ceph-new-pkg-review

« back to all changes in this revision

Viewing changes to src/messages/MMonObserve.h

  • Committer: Mathias Gug
  • Date: 2010-07-29 03:10:42 UTC
  • Revision ID: mathias.gug@canonical.com-20100729031042-n9n8kky962qb4onb
Import ceph_0.21-0ubuntu1 from https://launchpad.net/~clint-fewbar/+archive/ceph/+packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_MMONOBSERVE_H
 
16
#define CEPH_MMONOBSERVE_H
 
17
 
 
18
#include "msg/Message.h"
 
19
 
 
20
#include <vector>
 
21
using std::vector;
 
22
 
 
23
class MMonObserve : public PaxosServiceMessage {
 
24
 public:
 
25
  ceph_fsid_t fsid;
 
26
  uint32_t machine_id;
 
27
  version_t ver;
 
28
 
 
29
  MMonObserve() : PaxosServiceMessage(MSG_MON_OBSERVE, 0) {}
 
30
  MMonObserve(ceph_fsid_t &f, int mid, version_t v) : 
 
31
    PaxosServiceMessage(MSG_MON_OBSERVE, v),
 
32
    fsid(f), machine_id(mid), ver(v) { }
 
33
private:
 
34
  ~MMonObserve() {}
 
35
  
 
36
public:
 
37
  const char *get_type_name() { return "mon_observe"; }
 
38
  void print(ostream& o) {
 
39
    o << "observe(" << machine_id << " v" << ver << ")";
 
40
  }
 
41
  
 
42
  void encode_payload() {
 
43
    paxos_encode();
 
44
    ::encode(fsid, payload);
 
45
    ::encode(machine_id, payload);
 
46
    ::encode(ver, payload);
 
47
  }
 
48
  void decode_payload() {
 
49
    bufferlist::iterator p = payload.begin();
 
50
    paxos_decode(p);
 
51
    ::decode(fsid, p);
 
52
    ::decode(machine_id, p);
 
53
    ::decode(ver, p);
 
54
  }
 
55
};
 
56
 
 
57
#endif