]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/MDSTableServer.h
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_MDSTABLESERVER_H
16 #define CEPH_MDSTABLESERVER_H
20 class MMDSTableRequest
;
22 class MDSTableServer
: public MDSTable
{
25 map
<version_t
,mds_table_pending_t
> pending_for_mds
; // ** child should encode this! **
29 void handle_prepare(MMDSTableRequest
*m
);
30 void _prepare_logged(MMDSTableRequest
*m
, version_t tid
);
31 friend class C_Prepare
;
33 void handle_commit(MMDSTableRequest
*m
);
34 void _commit_logged(MMDSTableRequest
*m
);
35 friend class C_Commit
;
38 void handle_rollback(MMDSTableRequest
*m
);
41 virtual void handle_query(MMDSTableRequest
*m
) = 0;
42 virtual void _prepare(bufferlist
&bl
, uint64_t reqid
, mds_rank_t bymds
) = 0;
43 virtual bool _commit(version_t tid
, MMDSTableRequest
*req
=NULL
) = 0;
44 virtual void _rollback(version_t tid
) = 0;
45 virtual void _server_update(bufferlist
& bl
) { ceph_abort(); }
47 void _note_prepare(mds_rank_t mds
, uint64_t reqid
) {
48 pending_for_mds
[version
].mds
= mds
;
49 pending_for_mds
[version
].reqid
= reqid
;
50 pending_for_mds
[version
].tid
= version
;
52 void _note_commit(uint64_t tid
) {
53 pending_for_mds
.erase(tid
);
55 void _note_rollback(uint64_t tid
) {
56 pending_for_mds
.erase(tid
);
60 MDSTableServer(MDSRank
*m
, int tab
) : MDSTable(m
, get_mdstable_name(tab
), false), table(tab
) {}
61 ~MDSTableServer() override
{}
63 void handle_request(MMDSTableRequest
*m
);
64 void do_server_update(bufferlist
& bl
);
66 virtual void encode_server_state(bufferlist
& bl
) const = 0;
67 virtual void decode_server_state(bufferlist::iterator
& bl
) = 0;
69 void encode_state(bufferlist
& bl
) const override
{
70 encode_server_state(bl
);
71 ::encode(pending_for_mds
, bl
);
73 void decode_state(bufferlist::iterator
& bl
) override
{
74 decode_server_state(bl
);
75 ::decode(pending_for_mds
, bl
);
79 void finish_recovery(set
<mds_rank_t
>& active
);
80 void handle_mds_recovery(mds_rank_t who
);