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_PROMOTE_REQUEST_H
5 #define CEPH_LIBRBD_JOURNAL_PROMOTE_REQUEST_H
7 #include "include/int_types.h"
8 #include "common/Mutex.h"
9 #include "cls/journal/cls_journal_types.h"
10 #include "journal/Future.h"
11 #include "librbd/journal/Types.h"
12 #include "librbd/journal/TypeTraits.h"
22 template <typename ImageCtxT = ImageCtx>
23 class PromoteRequest {
25 static PromoteRequest* create(ImageCtxT *image_ctx, bool force,
27 return new PromoteRequest(image_ctx, force, on_finish);
30 PromoteRequest(ImageCtxT *image_ctx, bool force, Context *on_finish);
41 * OPEN * * * * * * * * * *
44 * ALLOCATE_TAG * * * * * *
47 * APPEND_EVENT * * * *
53 * STOP_APPEND <* * * *
56 * SHUT_DOWN <* * * * * * *
64 typedef typename TypeTraits<ImageCtxT>::Journaler Journaler;
65 typedef typename TypeTraits<ImageCtxT>::Future Future;
67 ImageCtxT *m_image_ctx;
71 Journaler *m_journaler = nullptr;
75 ImageClientMeta m_client_meta;
76 uint64_t m_tag_tid = 0;
79 cls::journal::Tag m_tag;
83 void handle_open(int r);
86 void handle_allocate_tag(int r);
89 void handle_append_event(int r);
92 void handle_commit_event(int r);
95 void handle_stop_append(int r);
98 void handle_shut_down(int r);
104 } // namespace journal
105 } // namespace librbd
107 extern template class librbd::journal::PromoteRequest<librbd::ImageCtx>;
109 #endif // CEPH_LIBRBD_JOURNAL_PROMOTE_REQUEST_H