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

« back to all changes in this revision

Viewing changes to src/messages/MClientReconnect.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_MCLIENTRECONNECT_H
 
16
#define CEPH_MCLIENTRECONNECT_H
 
17
 
 
18
#include "msg/Message.h"
 
19
#include "mds/mdstypes.h"
 
20
 
 
21
class MClientReconnect : public Message {
 
22
public:
 
23
  map<inodeno_t, cap_reconnect_t>  caps;   // only head inodes
 
24
  vector<ceph_mds_snaprealm_reconnect> realms;
 
25
 
 
26
  MClientReconnect() : Message(CEPH_MSG_CLIENT_RECONNECT) {}
 
27
private:
 
28
  ~MClientReconnect() {}
 
29
 
 
30
public:
 
31
  const char *get_type_name() { return "client_reconnect"; }
 
32
  void print(ostream& out) {
 
33
    out << "client_reconnect("
 
34
        << caps.size() << " caps)";
 
35
  }
 
36
 
 
37
  void add_cap(inodeno_t ino, uint64_t cap_id, inodeno_t pathbase, const string& path,
 
38
               int wanted, int issued,
 
39
               loff_t sz, utime_t mt, utime_t at,
 
40
               inodeno_t sr) {
 
41
    caps[ino] = cap_reconnect_t(cap_id, pathbase, path, wanted, issued, sz, mt, at, sr);
 
42
  }
 
43
  void add_snaprealm(inodeno_t ino, snapid_t seq, inodeno_t parent) {
 
44
    ceph_mds_snaprealm_reconnect r;
 
45
    r.ino = ino;
 
46
    r.seq = seq;
 
47
    r.parent = parent;
 
48
    realms.push_back(r);
 
49
  }
 
50
 
 
51
  void encode_payload() {
 
52
    ::encode(caps, data);
 
53
    ::encode_nohead(realms, data);
 
54
  }
 
55
  void decode_payload() {
 
56
    bufferlist::iterator p = data.begin();
 
57
    ::decode(caps, p);
 
58
    while (p.end()) {
 
59
      realms.push_back(ceph_mds_snaprealm_reconnect());
 
60
      ::decode(realms.back(), p);
 
61
    }
 
62
  }
 
63
 
 
64
};
 
65
 
 
66
 
 
67
#endif