1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H
5 #define CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "msg/msg_types.h"
12 #include <boost/optional.hpp>
13 #include "librbd/managed_lock/Types.h"
19 namespace librados
{ class IoCtx
; }
24 template <typename
> class Journal
;
26 namespace managed_lock
{
28 template <typename ImageCtxT
= ImageCtx
>
31 static BreakRequest
* create(librados::IoCtx
& ioctx
, ContextWQ
*work_queue
,
32 const std::string
& oid
, const Locker
&locker
,
33 bool blacklist_locker
,
34 uint32_t blacklist_expire_seconds
,
35 bool force_break_lock
, Context
*on_finish
) {
36 return new BreakRequest(ioctx
, work_queue
, oid
, locker
, blacklist_locker
,
37 blacklist_expire_seconds
, force_break_lock
,
53 * BLACKLIST (skip if disabled)
64 librados::IoCtx
&m_ioctx
;
66 ContextWQ
*m_work_queue
;
69 bool m_blacklist_locker
;
70 uint32_t m_blacklist_expire_seconds
;
71 bool m_force_break_lock
;
76 std::list
<obj_watch_t
> m_watchers
;
77 int m_watchers_ret_val
;
79 BreakRequest(librados::IoCtx
& ioctx
, ContextWQ
*work_queue
,
80 const std::string
& oid
, const Locker
&locker
,
81 bool blacklist_locker
, uint32_t blacklist_expire_seconds
,
82 bool force_break_lock
, Context
*on_finish
);
84 void send_get_watchers();
85 void handle_get_watchers(int r
);
87 void send_blacklist();
88 void handle_blacklist(int r
);
90 void send_break_lock();
91 void handle_break_lock(int r
);
97 } // namespace managed_lock
100 extern template class librbd::managed_lock::BreakRequest
<librbd::ImageCtx
>;
102 #endif // CEPH_LIBRBD_MANAGED_LOCK_BREAK_REQUEST_H