26#include <seastar/core/seastar.hh>
27#include <seastar/core/future.hh>
29#include <seastar/core/sstring.hh>
30#include <seastar/core/coroutine.hh>
31#include <seastar/coroutine/as_future.hh>
32#include <seastar/util/std-compat.hh>
33#include <seastar/util/short_streams.hh>
34#include <seastar/util/modules.hh>
67SEASTAR_MODULE_EXPORT_BEGIN
68template <
typename Func>
69requires std::invocable<Func, input_stream<char>&>
71 static_assert(std::is_nothrow_move_constructible_v<Func>);
72 auto f =
co_await open_file_dma(path.native(), open_flags::ro, std::move(file_opts));
74 std::exception_ptr ex;
78 ex = std::current_exception();
82 co_await coroutine::return_exception_ptr(std::move(ex));
88 co_return co_await std::move(res);
105SEASTAR_MODULE_EXPORT_END
co_await:s a future, returning it as result.
Definition: as_future.hh:86
A representation of a possibly not-yet-computed value.
Definition: future.hh:1240
future< std::vector< temporary_buffer< char > > > read_entire_file(std::filesystem::path path)
future< sstring > read_entire_file_contiguous(std::filesystem::path path)
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
future recursive_remove_directory(std::filesystem::path path) noexcept
input_stream< char > make_file_input_stream(file file, uint64_t offset, uint64_t len, file_input_stream_options options={})
Creates an input_stream to read a portion of a file.
Converts a type to a future type, if it isn't already.
Definition: future.hh:1853