diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/journal/Future.h | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/journal/Future.h')
-rw-r--r-- | src/journal/Future.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/journal/Future.h b/src/journal/Future.h new file mode 100644 index 000000000..ba835b353 --- /dev/null +++ b/src/journal/Future.h @@ -0,0 +1,57 @@ +// -*- 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 <iosfwd> +#include <string> + +#include "include/ceph_assert.h" +#include "include/int_types.h" +#include "common/ref.h" + +class Context; + +namespace journal { + +class FutureImpl; + +class Future { +public: + Future(); + Future(const Future&); + Future& operator=(const Future&); + Future(Future&&); + Future& operator=(Future&&); + Future(ceph::ref_t<FutureImpl> future_impl); + ~Future(); + + bool is_valid() const { + return bool(m_future_impl); + } + + 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&); + + const auto& get_future_impl() const { + return m_future_impl; + } + + ceph::ref_t<FutureImpl> m_future_impl; +}; + +std::ostream &operator<<(std::ostream &os, const Future &future); + +} // namespace journal + +using journal::operator<<; + +#endif // CEPH_JOURNAL_FUTURE_H |