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

Method ReadAt

cpp/src/arrow/filesystem/s3fs.cc:1574–1594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1572 }
1573
1574 Result<int64_t> ReadAt(int64_t position, int64_t nbytes, void* out) override {
1575 RETURN_NOT_OK(CheckClosed());
1576 RETURN_NOT_OK(CheckPosition(position, "read"));
1577
1578 nbytes = std::min(nbytes, content_length_ - position);
1579 if (nbytes == 0) {
1580 return 0;
1581 }
1582
1583 // Read the desired range of bytes
1584 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
1585 ARROW_ASSIGN_OR_RAISE(S3Model::GetObjectResult result,
1586 GetObjectRange(client_lock.get(), path_, sse_customer_key_,
1587 position, nbytes, out));
1588
1589 auto& stream = result.GetBody();
1590 stream.ignore(nbytes);
1591 // NOTE: the stream is a stringstream by default, there is no actual error
1592 // to check for. However, stream.fail() may return true if EOF is reached.
1593 return stream.gcount();
1594 }
1595
1596 Result<std::shared_ptr<Buffer>> ReadAt(int64_t position, int64_t nbytes) override {
1597 RETURN_NOT_OK(CheckClosed());

Callers

nothing calls this directly

Calls 2

CheckClosedFunction · 0.50
ResizeMethod · 0.45

Tested by

no test coverage detected