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

Method WillNeed

cpp/src/arrow/io/memory.cc:297–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295bool BufferReader::supports_zero_copy() const { return true; }
296
297Status BufferReader::WillNeed(const std::vector<ReadRange>& ranges) {
298 using ::arrow::internal::MemoryRegion;
299
300 RETURN_NOT_OK(CheckClosed());
301
302 std::vector<MemoryRegion> regions(ranges.size());
303 for (size_t i = 0; i < ranges.size(); ++i) {
304 const auto& range = ranges[i];
305 ARROW_ASSIGN_OR_RAISE(auto size,
306 internal::ValidateReadRange(range.offset, range.length, size_));
307 regions[i] = {const_cast<uint8_t*>(data_ + range.offset), static_cast<size_t>(size)};
308 }
309 const auto st = ::arrow::internal::MemoryAdviseWillNeed(regions);
310 if (st.IsIOError()) {
311 // Ignore any system-level errors, in case the memory area isn't madvise()-able
312 return Status::OK();
313 }
314 return st;
315}
316
317Future<std::shared_ptr<Buffer>> BufferReader::ReadAsync(const IOContext&,
318 int64_t position,

Callers

nothing calls this directly

Calls 4

MemoryAdviseWillNeedFunction · 0.85
CheckClosedFunction · 0.70
OKFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected