]> git.proxmox.com Git - ceph.git/blob - ceph/src/mds/events/ESessions.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / mds / events / ESessions.h
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_MDS_ESESSIONS_H
16 #define CEPH_MDS_ESESSIONS_H
17
18 #include "common/config.h"
19 #include "include/types.h"
20
21 #include "../LogEvent.h"
22
23 class ESessions : public LogEvent {
24 protected:
25 version_t cmapv; // client map version
26
27 public:
28 map<client_t,entity_inst_t> client_map;
29 bool old_style_encode;
30
31 ESessions() : LogEvent(EVENT_SESSIONS), cmapv(0), old_style_encode(false) { }
32 ESessions(version_t pv, map<client_t,entity_inst_t>& cm) :
33 LogEvent(EVENT_SESSIONS),
34 cmapv(pv),
35 old_style_encode(false) {
36 client_map.swap(cm);
37 }
38
39 void mark_old_encoding() { old_style_encode = true; }
40
41 void encode(bufferlist &bl, uint64_t features) const override;
42 void decode_old(bufferlist::iterator &bl);
43 void decode_new(bufferlist::iterator &bl);
44 void decode(bufferlist::iterator &bl) override {
45 if (old_style_encode) decode_old(bl);
46 else decode_new(bl);
47 }
48 void dump(Formatter *f) const override;
49 static void generate_test_instances(list<ESessions*>& ls);
50
51 void print(ostream& out) const override {
52 out << "ESessions " << client_map.size() << " opens cmapv " << cmapv;
53 }
54
55 void update_segment() override;
56 void replay(MDSRank *mds) override;
57 };
58 WRITE_CLASS_ENCODER_FEATURES(ESessions)
59
60 #endif