X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Flibrbd%2FAsyncObjectThrottle.h;fp=src%2Fceph%2Fsrc%2Flibrbd%2FAsyncObjectThrottle.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=e1b089626c3495e6e34466cfef1189061405a1f5;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/librbd/AsyncObjectThrottle.h b/src/ceph/src/librbd/AsyncObjectThrottle.h deleted file mode 100644 index e1b0896..0000000 --- a/src/ceph/src/librbd/AsyncObjectThrottle.h +++ /dev/null @@ -1,79 +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_OBJECT_THROTTLE_H -#define CEPH_LIBRBD_ASYNC_OBJECT_THROTTLE_H - -#include "include/int_types.h" -#include "include/Context.h" - -#include - -namespace librbd -{ -template class AsyncRequest; -class ProgressContext; -struct ImageCtx; - -class AsyncObjectThrottleFinisher { -public: - virtual ~AsyncObjectThrottleFinisher() {}; - virtual void finish_op(int r) = 0; -}; - -template -class C_AsyncObjectThrottle : public Context { -public: - C_AsyncObjectThrottle(AsyncObjectThrottleFinisher &finisher, - ImageCtxT &image_ctx) - : m_image_ctx(image_ctx), m_finisher(finisher) { - } - - virtual int send() = 0; - -protected: - ImageCtxT &m_image_ctx; - - void finish(int r) override { - m_finisher.finish_op(r); - } - -private: - AsyncObjectThrottleFinisher &m_finisher; -}; - -template -class AsyncObjectThrottle : public AsyncObjectThrottleFinisher { -public: - typedef boost::function< - C_AsyncObjectThrottle* (AsyncObjectThrottle&, - uint64_t)> ContextFactory; - - AsyncObjectThrottle(const AsyncRequest *async_request, - ImageCtxT &image_ctx, - const ContextFactory& context_factory, Context *ctx, - ProgressContext *prog_ctx, uint64_t object_no, - uint64_t end_object_no); - - void start_ops(uint64_t max_concurrent); - void finish_op(int r) override; - -private: - Mutex m_lock; - const AsyncRequest *m_async_request; - ImageCtxT &m_image_ctx; - ContextFactory m_context_factory; - Context *m_ctx; - ProgressContext *m_prog_ctx; - uint64_t m_object_no; - uint64_t m_end_object_no; - uint64_t m_current_ops; - int m_ret; - - void start_next_op(); -}; - -} // namespace librbd - -extern template class librbd::AsyncObjectThrottle; - -#endif // CEPH_LIBRBD_ASYNC_OBJECT_THROTTLE_H