]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/managed_lock/ReacquireRequest.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / librbd / managed_lock / ReacquireRequest.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_MANAGED_LOCK_REACQUIRE_REQUEST_H
5 #define CEPH_LIBRBD_MANAGED_LOCK_REACQUIRE_REQUEST_H
6
7 #include "include/rados/librados.hpp"
8 #include "include/int_types.h"
9 #include <string>
10
11 class Context;
12
13 namespace librbd {
14
15 class Watcher;
16
17 namespace managed_lock {
18
19 template <typename ImageCtxT>
20 class ReacquireRequest {
21 public:
22
23 static ReacquireRequest *create(librados::IoCtx& ioctx,
24 const std::string& oid,
25 const std::string& old_cookie,
26 const std::string &new_cookie,
27 bool exclusive,
28 Context *on_finish) {
29 return new ReacquireRequest(ioctx, oid, old_cookie, new_cookie, exclusive,
30 on_finish);
31 }
32
33 ReacquireRequest(librados::IoCtx& ioctx, const std::string& oid,
34 const std::string& old_cookie,
35 const std::string &new_cookie, bool exclusive,
36 Context *on_finish);
37
38 void send();
39
40 private:
41 /**
42 * @verbatim
43 *
44 * <start>
45 * |
46 * v
47 * SET_COOKIE
48 * |
49 * v
50 * <finish>
51 *
52 * @endverbatim
53 */
54 librados::IoCtx& m_ioctx;
55 std::string m_oid;
56 std::string m_old_cookie;
57 std::string m_new_cookie;
58 bool m_exclusive;
59 Context *m_on_finish;
60
61 void set_cookie();
62 void handle_set_cookie(int r);
63
64 };
65
66 } // namespace managed_lock
67 } // namespace librbd
68
69 #endif // CEPH_LIBRBD_MANAGED_LOCK_REACQUIRE_REQUEST_H