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_WATCHER_NOTIFIER_H
5 #define CEPH_LIBRBD_WATCHER_NOTIFIER_H
7 #include "include/int_types.h"
8 #include "include/buffer_fwd.h"
9 #include "include/Context.h"
10 #include "include/rados/librados.hpp"
11 #include "common/Mutex.h"
12 #include "common/WorkQueue.h"
19 struct NotifyResponse
;
23 static const uint64_t NOTIFY_TIMEOUT
;
25 Notifier(ContextWQ
*work_queue
, librados::IoCtx
&ioctx
,
26 const std::string
&oid
);
29 void flush(Context
*on_finish
);
30 void notify(bufferlist
&bl
, NotifyResponse
*response
, Context
*on_finish
);
33 typedef std::list
<Context
*> Contexts
;
35 struct C_AioNotify
: public Context
{
37 NotifyResponse
*response
;
41 C_AioNotify(Notifier
*notifier
, NotifyResponse
*response
,
44 void finish(int r
) override
;
47 ContextWQ
*m_work_queue
;
48 librados::IoCtx
&m_ioctx
;
52 Mutex m_aio_notify_lock
;
53 size_t m_pending_aio_notifies
= 0;
54 Contexts m_aio_notify_flush_ctxs
;
56 void handle_notify(int r
, Context
*on_finish
);
60 } // namespace watcher
63 #endif // CEPH_LIBRBD_WATCHER_NOTIFIER_H