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_JOURNAL_DEMOTE_REQUEST_H
5 #define CEPH_LIBRBD_JOURNAL_DEMOTE_REQUEST_H
7 #include "common/Mutex.h"
8 #include "cls/journal/cls_journal_types.h"
9 #include "journal/Future.h"
10 #include "librbd/journal/Types.h"
11 #include "librbd/journal/TypeTraits.h"
21 template <typename ImageCtxT = librbd::ImageCtx>
24 static DemoteRequest *create(ImageCtxT &image_ctx, Context *on_finish) {
25 return new DemoteRequest(image_ctx, on_finish);
28 DemoteRequest(ImageCtxT &image_ctx, Context *on_finish);
40 * OPEN_JOURNALER * * * * *
43 * ALLOCATE_TAG * * * * * *
46 * APPEND_EVENT * * * *
52 * STOP_APPEND <* * * *
55 * SHUT_DOWN_JOURNALER <* *
63 typedef typename TypeTraits<ImageCtxT>::Journaler Journaler;
64 typedef typename TypeTraits<ImageCtxT>::Future Future;
66 ImageCtxT &m_image_ctx;
69 Journaler *m_journaler = nullptr;
73 ImageClientMeta m_client_meta;
74 uint64_t m_tag_tid = 0;
77 cls::journal::Tag m_tag;
80 void open_journaler();
81 void handle_open_journaler(int r);
84 void handle_allocate_tag(int r);
87 void handle_append_event(int r);
90 void handle_commit_event(int r);
93 void handle_stop_append(int r);
95 void shut_down_journaler();
96 void handle_shut_down_journaler(int r);
102 } // namespace journal
103 } // namespace librbd
105 extern template class librbd::journal::DemoteRequest<librbd::ImageCtx>;
107 #endif // CEPH_LIBRBD_JOURNAL_DEMOTE_REQUEST_H