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