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

Method ReadAt

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

Source from the content-addressed store, hash-verified

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

Callers 8

TEST_FFunction · 0.45
TestOpenInputFileMethod · 0.45
TEST_FFunction · 0.45
TestBucketFunction · 0.45
TEST_FFunction · 0.45
NaiveReadFunction · 0.45
ChunkedReadFunction · 0.45

Calls 2

CheckClosedFunction · 0.50
ResizeMethod · 0.45

Tested by 6

TEST_FFunction · 0.36
TestOpenInputFileMethod · 0.36
TEST_FFunction · 0.36
TestBucketFunction · 0.36
TEST_FFunction · 0.36