]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/TrashWatcher.h
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_TRASH_WATCHER_H
5 #define CEPH_LIBRBD_TRASH_WATCHER_H
7 #include "include/int_types.h"
8 #include "include/rados/librados_fwd.hpp"
9 #include "cls/rbd/cls_rbd_types.h"
10 #include "librbd/ImageCtx.h"
11 #include "librbd/Watcher.h"
12 #include "librbd/trash_watcher/Types.h"
16 namespace asio
{ struct ContextWQ
; }
19 template <typename
> struct HandlePayloadVisitor
;
21 } // namespace watcher
23 template <typename ImageCtxT
= librbd::ImageCtx
>
24 class TrashWatcher
: public Watcher
{
25 friend struct watcher::util::HandlePayloadVisitor
<TrashWatcher
<ImageCtxT
>>;
27 TrashWatcher(librados::IoCtx
&io_ctx
, asio::ContextWQ
*work_queue
);
29 static void notify_image_added(librados::IoCtx
&io_ctx
,
30 const std::string
& image_id
,
31 const cls::rbd::TrashImageSpec
& spec
,
33 static void notify_image_removed(librados::IoCtx
&io_ctx
,
34 const std::string
& image_id
,
38 virtual void handle_image_added(const std::string
&image_id
,
39 const cls::rbd::TrashImageSpec
& spec
) = 0;
40 virtual void handle_image_removed(const std::string
&image_id
) = 0;
43 void handle_notify(uint64_t notify_id
, uint64_t handle
,
44 uint64_t notifier_id
, bufferlist
&bl
) override
;
46 bool handle_payload(const trash_watcher::ImageAddedPayload
&payload
,
47 Context
*on_notify_ack
);
48 bool handle_payload(const trash_watcher::ImageRemovedPayload
&payload
,
49 Context
*on_notify_ack
);
50 bool handle_payload(const trash_watcher::UnknownPayload
&payload
,
51 Context
*on_notify_ack
);
56 extern template class librbd::TrashWatcher
<librbd::ImageCtx
>;
58 #endif // CEPH_LIBRBD_TRASH_WATCHER_H