Commit 3275d892 authored by Shai Szulanski's avatar Shai Szulanski Committed by Facebook GitHub Bot

makeUnorderedAsyncGeneratorFromAwaitableRange -> makeUnorderedAsyncGenerator

Summary: We use the FromBla to distinguish collect-range (type fixed, count varies) algorithms from collect-tuple (types vary, count fixed) algorithms. But in this case there is no sensible translation from collect-tuple to an async-generator so the from-range bit is not necessary.

Reviewed By: vitaut

Differential Revision: D29877021

fbshipit-source-id: 69dfa764fca880bd3770a4d57ff0d60fe500a206
parent 937fc980
......@@ -212,7 +212,7 @@ auto collectAllImpl(
}
template <typename InputRange, typename IsTry>
auto makeUnorderedAsyncGeneratorFromAwaitableRangeImpl(
auto makeUnorderedAsyncGeneratorImpl(
AsyncScope& scope, InputRange awaitables, IsTry) {
using Item =
async_generator_from_awaitable_range_item_t<InputRange, IsTry::value>;
......@@ -1003,12 +1003,11 @@ auto collectAllTryWindowed(InputRange awaitables, std::size_t maxConcurrency)
}
template <typename InputRange>
auto makeUnorderedAsyncGeneratorFromAwaitableRange(
AsyncScope& scope, InputRange awaitables)
auto makeUnorderedAsyncGenerator(AsyncScope& scope, InputRange awaitables)
-> AsyncGenerator<detail::async_generator_from_awaitable_range_item_t<
InputRange,
false>&&> {
return detail::makeUnorderedAsyncGeneratorFromAwaitableRangeImpl(
return detail::makeUnorderedAsyncGeneratorImpl(
scope, std::move(awaitables), bool_constant<false>{});
}
......@@ -1018,7 +1017,7 @@ auto makeUnorderedAsyncGeneratorFromAwaitableTryRange(
-> AsyncGenerator<detail::async_generator_from_awaitable_range_item_t<
InputRange,
true>&&> {
return detail::makeUnorderedAsyncGeneratorFromAwaitableRangeImpl(
return detail::makeUnorderedAsyncGeneratorImpl(
scope, std::move(awaitables), bool_constant<true>{});
}
......
......@@ -245,7 +245,7 @@ using async_generator_from_awaitable_range_item_t = conditional_t<
}
////////////////////////////////////////////////////////////////////////////
// makeUnorderedAsyncGeneratorFromAwaitableRange(AsyncScope&,
// makeUnorderedAsyncGenerator(AsyncScope&,
// RangeOf<SemiAwaitable<T>>&&) -> AsyncGenerator<T&&>
// makeUnorderedAsyncGeneratorFromAwaitableTryRange(AsyncScope&,
// RangeOf<SemiAwaitable<T>>&&) -> AsyncGenerator<Try<T>&&>
......@@ -254,7 +254,7 @@ using async_generator_from_awaitable_range_item_t = conditional_t<
// order of completion.
// Destroying or cancelling the AsyncGenerator cancels the remaining awaitables.
//
// makeUnorderedAsyncGeneratorFromAwaitableRange cancels all remaining
// makeUnorderedAsyncGenerator cancels all remaining
// awaitables when any of them fail with an exception. Any results obtained
// before the failure are still returned via the generator, then the first
// exception in time. makeUnorderedAsyncGeneratorFromAwaitableTryRange does not
......@@ -263,8 +263,7 @@ using async_generator_from_awaitable_range_item_t = conditional_t<
// Awaitables are attached to the passed-in AsyncScope.
template <typename InputRange>
auto makeUnorderedAsyncGeneratorFromAwaitableRange(
AsyncScope& scope, InputRange awaitables)
auto makeUnorderedAsyncGenerator(AsyncScope& scope, InputRange awaitables)
-> AsyncGenerator<detail::async_generator_from_awaitable_range_item_t<
InputRange,
false>&&>;
......@@ -276,11 +275,11 @@ auto makeUnorderedAsyncGeneratorFromAwaitableTryRange(
true>&&>;
template <typename SemiAwaitable>
auto makeUnorderedAsyncGeneratorFromAwaitableRange(
auto makeUnorderedAsyncGenerator(
AsyncScope& scope, std::vector<SemiAwaitable> awaitables)
-> decltype(makeUnorderedAsyncGeneratorFromAwaitableRange(
-> decltype(makeUnorderedAsyncGenerator(
scope, awaitables | ranges::views::move)) {
co_return co_await makeUnorderedAsyncGeneratorFromAwaitableRange(
co_return co_await makeUnorderedAsyncGenerator(
scope, awaitables | ranges::views::move);
}
template <typename SemiAwaitable>
......
......@@ -833,8 +833,8 @@ TEST_F(CollectAllRangeTest, GeneatorFromRange) {
}
};
auto results = folly::coro::makeUnorderedAsyncGeneratorFromAwaitableRange(
scope, generateTasks());
auto results =
folly::coro::makeUnorderedAsyncGenerator(scope, generateTasks());
// co_await doesn't work inside EXPECT_EQ
EXPECT_TRUE(*(co_await results.next()) == 1);
EXPECT_TRUE(*(co_await results.next()) == 2);
......@@ -857,8 +857,8 @@ TEST_F(CollectAllRangeTest, GeneatorFromRangePartialConsume) {
}
};
auto results = folly::coro::makeUnorderedAsyncGeneratorFromAwaitableRange(
scope, generateTasks());
auto results =
folly::coro::makeUnorderedAsyncGenerator(scope, generateTasks());
for (int i = 0; i < 3; ++i) {
co_await results.next();
}
......@@ -884,8 +884,8 @@ TEST_F(CollectAllRangeTest, GeneatorFromRangeFailed) {
}
};
auto results = folly::coro::makeUnorderedAsyncGeneratorFromAwaitableRange(
scope, generateTasks());
auto results =
folly::coro::makeUnorderedAsyncGenerator(scope, generateTasks());
// co_await doesn't work inside EXPECT_EQ
EXPECT_TRUE(*(co_await results.next()) == 1);
EXPECT_TRUE(*(co_await results.next()) == 2);
......@@ -914,8 +914,8 @@ TEST_F(CollectAllRangeTest, GeneatorFromRangeCancelled) {
}
};
auto start = std::chrono::steady_clock::now();
auto results = folly::coro::makeUnorderedAsyncGeneratorFromAwaitableRange(
scope, generateTasks());
auto results =
folly::coro::makeUnorderedAsyncGenerator(scope, generateTasks());
auto result = co_await folly::coro::co_withCancellation(
cancelSource.getToken(), co_awaitTry(results.next()));
auto end = std::chrono::steady_clock::now();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment