]>
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_SNAPCLIENT_H | |
16 | #define CEPH_SNAPCLIENT_H | |
17 | ||
94b18763 FG |
18 | #include <boost/utility/string_view.hpp> |
19 | ||
7c673cae FG |
20 | #include "MDSTableClient.h" |
21 | #include "snap.h" | |
22 | ||
23 | class MDSInternalContextBase; | |
24 | class MDSRank; | |
25 | class LogSegment; | |
26 | ||
27 | class SnapClient : public MDSTableClient { | |
28 | public: | |
29 | explicit SnapClient(MDSRank *m) : MDSTableClient(m, TABLE_SNAP) {} | |
30 | ||
31 | void resend_queries() override {} | |
32 | void handle_query_result(MMDSTableRequest *m) override {} | |
33 | ||
94b18763 | 34 | void prepare_create(inodeno_t dirino, boost::string_view name, utime_t stamp, |
7c673cae FG |
35 | version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) { |
36 | bufferlist bl; | |
37 | __u32 op = TABLE_OP_CREATE; | |
38 | ::encode(op, bl); | |
39 | ::encode(dirino, bl); | |
40 | ::encode(name, bl); | |
41 | ::encode(stamp, bl); | |
42 | _prepare(bl, pstid, pbl, onfinish); | |
43 | } | |
44 | ||
45 | void prepare_create_realm(inodeno_t ino, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) { | |
46 | bufferlist bl; | |
47 | __u32 op = TABLE_OP_CREATE; | |
48 | ::encode(op, bl); | |
49 | ::encode(ino, bl); | |
50 | _prepare(bl, pstid, pbl, onfinish); | |
51 | } | |
52 | ||
53 | void prepare_destroy(inodeno_t ino, snapid_t snapid, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) { | |
54 | bufferlist bl; | |
55 | __u32 op = TABLE_OP_DESTROY; | |
56 | ::encode(op, bl); | |
57 | ::encode(ino, bl); | |
58 | ::encode(snapid, bl); | |
59 | _prepare(bl, pstid, pbl, onfinish); | |
60 | } | |
61 | ||
94b18763 | 62 | void prepare_update(inodeno_t ino, snapid_t snapid, boost::string_view name, utime_t stamp, |
7c673cae FG |
63 | version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) { |
64 | bufferlist bl; | |
65 | __u32 op = TABLE_OP_UPDATE; | |
66 | ::encode(op, bl); | |
67 | ::encode(ino, bl); | |
68 | ::encode(snapid, bl); | |
69 | ::encode(name, bl); | |
70 | ::encode(stamp, bl); | |
71 | _prepare(bl, pstid, pbl, onfinish); | |
72 | } | |
73 | }; | |
74 | ||
75 | #endif |