X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fjournal%2FFuture.h;fp=src%2Fceph%2Fsrc%2Fjournal%2FFuture.h;h=1ddb606563282e8c6e3b74e0d297936c238401af;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/journal/Future.h b/src/ceph/src/journal/Future.h new file mode 100644 index 0000000..1ddb606 --- /dev/null +++ b/src/ceph/src/journal/Future.h @@ -0,0 +1,58 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_JOURNAL_FUTURE_H +#define CEPH_JOURNAL_FUTURE_H + +#include "include/int_types.h" +#include +#include +#include +#include "include/assert.h" + +class Context; + +namespace journal { + +class FutureImpl; + +class Future { +public: + typedef boost::intrusive_ptr FutureImplPtr; + + Future() {} + Future(const FutureImplPtr &future_impl) : m_future_impl(future_impl) {} + + inline bool is_valid() const { + return m_future_impl.get() != nullptr; + } + + void flush(Context *on_safe); + void wait(Context *on_safe); + + bool is_complete() const; + int get_return_value() const; + +private: + friend class Journaler; + friend std::ostream& operator<<(std::ostream&, const Future&); + + inline FutureImplPtr get_future_impl() const { + return m_future_impl; + } + + FutureImplPtr m_future_impl; +}; + +void intrusive_ptr_add_ref(FutureImpl *p); +void intrusive_ptr_release(FutureImpl *p); + +std::ostream &operator<<(std::ostream &os, const Future &future); + +} // namespace journal + +using journal::intrusive_ptr_add_ref; +using journal::intrusive_ptr_release; +using journal::operator<<; + +#endif // CEPH_JOURNAL_FUTURE_H