]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | |
11fdf7f2 | 26 | bool old_style_encode; |
7c673cae FG |
27 | |
28 | public: | |
29 | map<client_t,entity_inst_t> client_map; | |
11fdf7f2 | 30 | map<client_t,client_metadata_t> client_metadata_map; |
7c673cae FG |
31 | |
32 | ESessions() : LogEvent(EVENT_SESSIONS), cmapv(0), old_style_encode(false) { } | |
11fdf7f2 TL |
33 | ESessions(version_t pv, map<client_t,entity_inst_t>&& cm, |
34 | map<client_t,client_metadata_t>&& cmm) : | |
7c673cae | 35 | LogEvent(EVENT_SESSIONS), |
11fdf7f2 TL |
36 | cmapv(pv), old_style_encode(false), |
37 | client_map(std::move(cm)), | |
38 | client_metadata_map(std::move(cmm)) {} | |
7c673cae FG |
39 | |
40 | void mark_old_encoding() { old_style_encode = true; } | |
41 | ||
42 | void encode(bufferlist &bl, uint64_t features) const override; | |
11fdf7f2 TL |
43 | void decode_old(bufferlist::const_iterator &bl); |
44 | void decode_new(bufferlist::const_iterator &bl); | |
45 | void decode(bufferlist::const_iterator &bl) override { | |
7c673cae FG |
46 | if (old_style_encode) decode_old(bl); |
47 | else decode_new(bl); | |
48 | } | |
49 | void dump(Formatter *f) const override; | |
50 | static void generate_test_instances(list<ESessions*>& ls); | |
51 | ||
52 | void print(ostream& out) const override { | |
53 | out << "ESessions " << client_map.size() << " opens cmapv " << cmapv; | |
54 | } | |
55 | ||
56 | void update_segment() override; | |
57 | void replay(MDSRank *mds) override; | |
58 | }; | |
59 | WRITE_CLASS_ENCODER_FEATURES(ESessions) | |
60 | ||
61 | #endif |