Add the given ranges to the cache, coalescing them where possible
| 174 | |
| 175 | // Add the given ranges to the cache, coalescing them where possible |
| 176 | virtual Status Cache(std::vector<ReadRange> ranges) { |
| 177 | ARROW_ASSIGN_OR_RAISE( |
| 178 | ranges, internal::CoalesceReadRanges(std::move(ranges), options.hole_size_limit, |
| 179 | options.range_size_limit)); |
| 180 | std::vector<RangeCacheEntry> new_entries = MakeCacheEntries(ranges); |
| 181 | // Add new entries, themselves ordered by offset |
| 182 | if (entries.size() > 0) { |
| 183 | std::vector<RangeCacheEntry> merged(entries.size() + new_entries.size()); |
| 184 | std::merge(entries.begin(), entries.end(), new_entries.begin(), new_entries.end(), |
| 185 | merged.begin()); |
| 186 | entries = std::move(merged); |
| 187 | } else { |
| 188 | entries = std::move(new_entries); |
| 189 | } |
| 190 | // Prefetch immediately, regardless of executor availability, if possible |
| 191 | auto st = file->WillNeed(ranges); |
| 192 | // As this is optimisation only, I/O failures should not be treated as fatal |
| 193 | if (st.IsIOError()) { |
| 194 | return Status::OK(); |
| 195 | } |
| 196 | return st; |
| 197 | } |
| 198 | |
| 199 | // Read the given range from the cache, blocking if needed. Cannot read a range |
| 200 | // that spans cache entries. |
nothing calls this directly
no test coverage detected