summaryrefslogtreecommitdiffstats
path: root/src/librbd/image/ListWatchersRequest.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/librbd/image/ListWatchersRequest.h
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librbd/image/ListWatchersRequest.h')
-rw-r--r--src/librbd/image/ListWatchersRequest.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/librbd/image/ListWatchersRequest.h b/src/librbd/image/ListWatchersRequest.h
new file mode 100644
index 00000000..941bf728
--- /dev/null
+++ b/src/librbd/image/ListWatchersRequest.h
@@ -0,0 +1,81 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_LIBRBD_IMAGE_LIST_WATCHERS_REQUEST_H
+#define CEPH_LIBRBD_IMAGE_LIST_WATCHERS_REQUEST_H
+
+#include "include/rados/rados_types.hpp"
+
+#include <list>
+
+class Context;
+
+namespace librbd {
+
+class ImageCtx;
+
+namespace image {
+
+enum {
+ LIST_WATCHERS_FILTER_OUT_MY_INSTANCE = 1 << 0,
+ LIST_WATCHERS_FILTER_OUT_MIRROR_INSTANCES = 1 << 1,
+};
+
+template<typename ImageCtxT = ImageCtx>
+class ListWatchersRequest {
+public:
+ static ListWatchersRequest *create(ImageCtxT &image_ctx, int flags,
+ std::list<obj_watch_t> *watchers,
+ Context *on_finish) {
+ return new ListWatchersRequest(image_ctx, flags, watchers, on_finish);
+ }
+
+ void send();
+
+private:
+ /**
+ * @verbatim
+ *
+ * <start>
+ * |
+ * v
+ * LIST_IMAGE_WATCHERS
+ * |
+ * v
+ * LIST_MIRROR_WATCHERS (skip if not needed)
+ * |
+ * v
+ * <finish>
+ *
+ * @endverbatim
+ */
+
+ ListWatchersRequest(ImageCtxT &image_ctx, int flags, std::list<obj_watch_t> *watchers,
+ Context *on_finish);
+
+ ImageCtxT& m_image_ctx;
+ int m_flags;
+ std::list<obj_watch_t> *m_watchers;
+ Context *m_on_finish;
+
+ CephContext *m_cct;
+ int m_ret_val;
+ bufferlist m_out_bl;
+ std::list<obj_watch_t> m_object_watchers;
+ std::list<obj_watch_t> m_mirror_watchers;
+
+ void list_image_watchers();
+ void handle_list_image_watchers(int r);
+
+ void list_mirror_watchers();
+ void handle_list_mirror_watchers(int r);
+
+ void finish(int r);
+};
+
+} // namespace image
+} // namespace librbd
+
+extern template class librbd::image::ListWatchersRequest<librbd::ImageCtx>;
+
+#endif // CEPH_LIBRBD_IMAGE_LIST_WATCHERS_REQUEST_H