X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Flibrbd%2FAsyncRequest.h;fp=src%2Fceph%2Fsrc%2Flibrbd%2FAsyncRequest.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=f74368dc644f68325a78aab8eafb3a9eed7c9069;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/librbd/AsyncRequest.h b/src/ceph/src/librbd/AsyncRequest.h deleted file mode 100644 index f74368d..0000000 --- a/src/ceph/src/librbd/AsyncRequest.h +++ /dev/null @@ -1,76 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -#ifndef CEPH_LIBRBD_ASYNC_REQUEST_H -#define CEPH_LIBRBD_ASYNC_REQUEST_H - -#include "include/Context.h" -#include "include/rados/librados.hpp" -#include "include/xlist.h" -#include "include/compat.h" - -namespace librbd { - -class ImageCtx; - -template -class AsyncRequest -{ -public: - AsyncRequest(ImageCtxT &image_ctx, Context *on_finish); - virtual ~AsyncRequest(); - - void complete(int r) { - if (should_complete(r)) { - r = filter_return_code(r); - finish_and_destroy(r); - } - } - - virtual void send() = 0; - - inline bool is_canceled() const { - return m_canceled; - } - inline void cancel() { - m_canceled = true; - } - -protected: - ImageCtxT &m_image_ctx; - - librados::AioCompletion *create_callback_completion(); - Context *create_callback_context(); - Context *create_async_callback_context(); - - void async_complete(int r); - - virtual bool should_complete(int r) = 0; - virtual int filter_return_code(int r) const { - return r; - } - - // NOTE: temporary until converted to new state machine format - virtual void finish_and_destroy(int r) { - finish(r); - delete this; - } - - virtual void finish(int r) { - finish_request(); - m_on_finish->complete(r); - } - -private: - Context *m_on_finish; - bool m_canceled; - typename xlist *>::item m_xlist_item; - - void start_request(); - void finish_request(); -}; - -} // namespace librbd - -extern template class librbd::AsyncRequest; - -#endif //CEPH_LIBRBD_ASYNC_REQUEST_H