24#include <seastar/core/future.hh>
25#include <seastar/util/modules.hh>
33SEASTAR_MODULE_EXPORT_BEGIN
53template <
typename... T>
56template <
typename... T>
59template <
typename... T>
73 _next = std::move(next);
81 void operator=(
const stream&) =
delete;
82 void operator=(
stream&&) =
delete;
93 start(std::move(next));
118 template <
typename E>
119 void set_exception(E ex) {
126template <
typename... T>
134 using next_fn =
typename stream<T...>::next_fn;
143 return _stream->start(std::move(next));
149 return std::move(_done);
152 friend class stream<T...>;
154SEASTAR_MODULE_EXPORT_END
156template <
typename... T>
159stream<T...>::produce(T... data) {
160 auto ret = futurize_invoke(_next, std::move(data)...);
161 if (ret.available() && !ret.failed()) {
169 return ret.then_wrapped([
this] (
auto&& f) {
173 _done.set_exception(std::current_exception());
A representation of a possibly not-yet-computed value.
Definition: future.hh:1240
void set_value(A &&... a) noexcept
Sets the promises value.
Definition: future.hh:990
void set_exception(std::exception_ptr &&ex) noexcept
Marks the promise as failed.
Definition: future.hh:998
Definition: stream.hh:127
void start(next_fn next)
Start receiving events from the stream.
Definition: stream.hh:142
future< T > get_future() noexcept
Gets the promise's associated future.
Definition: future.hh:1926
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
Definition: noncopyable_function.hh:37