]>
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_ESESSION_H | |
16 | #define CEPH_MDS_ESESSION_H | |
17 | ||
18 | #include "common/config.h" | |
19 | #include "include/types.h" | |
20 | ||
21 | #include "../LogEvent.h" | |
22 | ||
23 | class ESession : public LogEvent { | |
24 | protected: | |
25 | entity_inst_t client_inst; | |
26 | bool open; // open or close | |
c07f9fc5 | 27 | version_t cmapv{0}; // client map version |
7c673cae FG |
28 | |
29 | interval_set<inodeno_t> inos; | |
c07f9fc5 | 30 | version_t inotablev{0}; |
7c673cae FG |
31 | |
32 | // Client metadata stored during open | |
33 | std::map<std::string, std::string> client_metadata; | |
34 | ||
35 | public: | |
36 | ESession() : LogEvent(EVENT_SESSION), open(false) { } | |
37 | ESession(const entity_inst_t& inst, bool o, version_t v, | |
38 | const std::map<std::string, std::string> &cm) : | |
39 | LogEvent(EVENT_SESSION), | |
40 | client_inst(inst), | |
41 | open(o), | |
42 | cmapv(v), | |
43 | inotablev(0), | |
44 | client_metadata(cm) { | |
45 | } | |
46 | ESession(const entity_inst_t& inst, bool o, version_t v, | |
47 | const interval_set<inodeno_t>& i, version_t iv) : | |
48 | LogEvent(EVENT_SESSION), | |
49 | client_inst(inst), | |
50 | open(o), | |
51 | cmapv(v), | |
52 | inos(i), inotablev(iv) { } | |
53 | ||
54 | void encode(bufferlist& bl, uint64_t features) const override; | |
55 | void decode(bufferlist::iterator& bl) override; | |
56 | void dump(Formatter *f) const override; | |
57 | static void generate_test_instances(list<ESession*>& ls); | |
58 | ||
59 | void print(ostream& out) const override { | |
60 | if (open) | |
61 | out << "ESession " << client_inst << " open cmapv " << cmapv; | |
62 | else | |
63 | out << "ESession " << client_inst << " close cmapv " << cmapv; | |
64 | if (inos.size()) | |
65 | out << " (" << inos.size() << " inos, v" << inotablev << ")"; | |
66 | } | |
67 | ||
68 | void update_segment() override; | |
69 | void replay(MDSRank *mds) override; | |
70 | entity_inst_t get_client_inst() const {return client_inst;} | |
71 | }; | |
72 | WRITE_CLASS_ENCODER_FEATURES(ESession) | |
73 | ||
74 | #endif |