| 241 | } |
| 242 | |
| 243 | Result<std::shared_ptr<Buffer>> ReadBufferAt(int64_t position, int64_t nbytes, |
| 244 | bool allow_short_read) { |
| 245 | ARROW_ASSIGN_OR_RAISE(auto buffer, AllocateResizableBuffer(nbytes, pool_)); |
| 246 | |
| 247 | ARROW_ASSIGN_OR_RAISE(int64_t bytes_read, ReadAt(position, nbytes, allow_short_read, |
| 248 | buffer->mutable_data())); |
| 249 | if (bytes_read < nbytes) { |
| 250 | RETURN_NOT_OK(buffer->Resize(bytes_read)); |
| 251 | buffer->ZeroPadding(); |
| 252 | } |
| 253 | return buffer; |
| 254 | } |
| 255 | |
| 256 | Status WillNeed(const std::vector<ReadRange>& ranges) { |
| 257 | auto report_error = [](int errnum, const char* msg) -> Status { |