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

Method Init

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

Source from the content-addressed store, hash-verified

1487 sse_customer_key_(sse_customer_key) {}
1488
1489 Status Init() {
1490 // Issue a HEAD Object to get the content-length and ensure any
1491 // errors (e.g. file not found) don't wait until the first Read() call.
1492 if (content_length_ != kNoSize) {
1493 DCHECK_GE(content_length_, 0);
1494 return Status::OK();
1495 }
1496
1497 S3Model::HeadObjectRequest req;
1498 req.SetBucket(ToAwsString(path_.bucket));
1499 req.SetKey(ToAwsString(path_.key));
1500 RETURN_NOT_OK(SetSSECustomerKey(&req, sse_customer_key_));
1501
1502 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
1503 auto outcome = client_lock.Move()->HeadObject(req);
1504 if (!outcome.IsSuccess()) {
1505 if (IsNotFound(outcome.GetError())) {
1506 return PathNotFound(path_);
1507 } else {
1508 return ErrorToStatus(
1509 std::forward_as_tuple("When reading information for key '", path_.key,
1510 "' in bucket '", path_.bucket, "': "),
1511 "HeadObject", outcome.GetError());
1512 }
1513 }
1514 content_length_ = outcome.GetResult().GetContentLength();
1515 DCHECK_GE(content_length_, 0);
1516 metadata_ = GetObjectMetadata(outcome.GetResult());
1517 return Status::OK();
1518 }
1519
1520 Status CheckClosed() const {
1521 if (closed_) {

Callers

nothing calls this directly

Calls 10

ToAwsStringFunction · 0.85
SetSSECustomerKeyFunction · 0.85
IsNotFoundFunction · 0.85
ErrorToStatusFunction · 0.85
GetObjectMetadataFunction · 0.85
PathNotFoundFunction · 0.70
OKFunction · 0.50
MoveMethod · 0.45
GetContentLengthMethod · 0.45
GetResultMethod · 0.45

Tested by

no test coverage detected