MCPcopy Create free account
hub / github.com/apache/arrow / NewBackgroundAsyncVectorIt

Function NewBackgroundAsyncVectorIt

cpp/src/arrow/util/async_generator_test.cc:69–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69std::function<Future<TestInt>()> NewBackgroundAsyncVectorIt(std::vector<TestInt> v,
70 bool sleep = true) {
71 auto pool = internal::GetCpuThreadPool();
72 auto iterator = VectorIt(v);
73 auto slow_iterator = MakeTransformedIterator<TestInt, TestInt>(
74 std::move(iterator), [sleep](TestInt item) -> Result<TransformFlow<TestInt>> {
75 if (sleep) {
76 SleepABit();
77 }
78 return TransformYield(item);
79 });
80
81 EXPECT_OK_AND_ASSIGN(auto background,
82 MakeBackgroundGenerator<TestInt>(std::move(slow_iterator), pool));
83 return MakeTransferredGenerator(background, pool);
84}
85
86template <typename T>
87void AssertAsyncGeneratorMatch(std::vector<T> expected, AsyncGenerator<T> actual) {

Callers 1

TESTFunction · 0.85

Calls 5

GetCpuThreadPoolFunction · 0.85
SleepABitFunction · 0.85
TransformYieldFunction · 0.85
MakeTransferredGeneratorFunction · 0.85
VectorItFunction · 0.70

Tested by

no test coverage detected