Skip to content

Commit

Permalink
treewide: replace generator with async_generator
Browse files Browse the repository at this point in the history
* replace coroutine::experimental::generator with
  coroutine::experimental::async_generator
* remove the generator related tests in coroutines_test.cc. since
  we already have tests/unit/generator_test.cc, there are no needs
  to keep two copies of these tests.
* update `experimental_list_directory()` to return `generator<const
  directory_entry&>`, for better performance, so we can point the
  promise's value pointer to the yielded value, without copying it
  using the copy_awaiter.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jul 22, 2024
1 parent 8e2ac17 commit 035f3e8
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 1,021 deletions.
4 changes: 2 additions & 2 deletions include/seastar/core/file.hh
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public:
virtual subscription<directory_entry> list_directory(std::function<future<> (directory_entry de)> next) = 0;
// due to https://github.com/scylladb/seastar/issues/1913, we cannot use
// buffered generator yet.
virtual coroutine::experimental::generator<directory_entry> experimental_list_directory();
virtual coroutine::experimental::generator<const directory_entry&> experimental_list_directory();
};

future<shared_ptr<file_impl>> make_file_impl(int fd, file_open_options options, int oflags, struct stat st) noexcept;
Expand Down Expand Up @@ -692,7 +692,7 @@ public:
/// Returns a directory listing, given that this file object is a directory.
// due to https://github.com/scylladb/seastar/issues/1913, we cannot use
// buffered generator yet.
coroutine::experimental::generator<directory_entry> experimental_list_directory();
coroutine::experimental::generator<const directory_entry&> experimental_list_directory();

#if SEASTAR_API_LEVEL < 7
/**
Expand Down
Loading

0 comments on commit 035f3e8

Please sign in to comment.