summaryrefslogtreecommitdiffstats
path: root/src/mds/events/ESession.h
blob: 8771aa1ce73c60f868ca7a398e7f9ba7042f0463 (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
// -*- 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 __MDS_ESESSION_H
#define __MDS_ESESSION_H

#include "config.h"
#include "include/types.h"

#include "../LogEvent.h"

class ESession : public LogEvent {
 protected:
  entity_inst_t client_inst;
  bool open;    // open or close
  version_t cmapv;  // client map version

 public:
  ESession() : LogEvent(EVENT_SESSION) { }
  ESession(entity_inst_t inst, bool o, version_t v) :
    LogEvent(EVENT_SESSION),
    client_inst(inst),
    open(o),
    cmapv(v) {
  }
  
  void encode(bufferlist &bl) const {
    ::encode(client_inst, bl);
    ::encode(open, bl);
    ::encode(cmapv, bl);
  }
  void decode(bufferlist::iterator &bl) {
    ::decode(client_inst, bl);
    ::decode(open, bl);
    ::decode(cmapv, bl);
  }


  void print(ostream& out) {
    if (open)
      out << "ESession " << client_inst << " open cmapv " << cmapv;
    else
      out << "ESession " << client_inst << " close cmapv " << cmapv;
  }
  
  void update_segment();
  void replay(MDS *mds);  
};

#endif