1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
15 #ifndef CEPH_MDS_ESESSION_H
16 #define CEPH_MDS_ESESSION_H
18 #include "common/config.h"
19 #include "include/types.h"
21 #include "../LogEvent.h"
23 class ESession
: public LogEvent
{
25 entity_inst_t client_inst
;
26 bool open
; // open or close
27 version_t cmapv
; // client map version
29 interval_set
<inodeno_t
> inos
;
32 // Client metadata stored during open
33 std::map
<std::string
, std::string
> client_metadata
;
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
),
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
),
52 inos(i
), inotablev(iv
) { }
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
);
59 void print(ostream
& out
) const override
{
61 out
<< "ESession " << client_inst
<< " open cmapv " << cmapv
;
63 out
<< "ESession " << client_inst
<< " close cmapv " << cmapv
;
65 out
<< " (" << inos
.size() << " inos, v" << inotablev
<< ")";
68 void update_segment() override
;
69 void replay(MDSRank
*mds
) override
;
70 entity_inst_t
get_client_inst() const {return client_inst
;}
72 WRITE_CLASS_ENCODER_FEATURES(ESession
)