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

Function NewBackgroundAsyncVectorIt

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected