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

Method WaitFor

cpp/src/arrow/io/caching.cc:243–263  ·  view source on GitHub ↗

Return a Future that completes when the given ranges have been read.

Source from the content-addressed store, hash-verified

241
242 // Return a Future that completes when the given ranges have been read.
243 virtual Future<> WaitFor(std::vector<ReadRange> ranges) {
244 auto end = std::remove_if(ranges.begin(), ranges.end(),
245 [](const ReadRange& range) { return range.length == 0; });
246 ranges.resize(end - ranges.begin());
247 std::vector<Future<>> futures;
248 futures.reserve(ranges.size());
249 for (auto& range : ranges) {
250 const auto it = std::lower_bound(
251 entries.begin(), entries.end(), range,
252 [](const RangeCacheEntry& entry, const ReadRange& range) {
253 return entry.range.offset + entry.range.length < range.offset + range.length;
254 });
255 if (it != entries.end() && it->range.Contains(range)) {
256 futures.push_back(Future<>(MaybeRead(&*it)));
257 } else {
258 return Status::Invalid("Range was not requested for caching: offset=",
259 range.offset, " length=", range.length);
260 }
261 }
262 return AllComplete(futures);
263 }
264};
265
266// Don't read ranges when they're first added. Instead, wait until they're requested

Callers

nothing calls this directly

Calls 9

AllCompleteFunction · 0.85
resizeMethod · 0.80
push_backMethod · 0.80
InvalidFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected