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

Method Init

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

Source from the content-addressed store, hash-verified

1425 sse_customer_key_(sse_customer_key) {}
1426
1427 Status Init() {
1428 // Issue a HEAD Object to get the content-length and ensure any
1429 // errors (e.g. file not found) don't wait until the first Read() call.
1430 if (content_length_ != kNoSize) {
1431 DCHECK_GE(content_length_, 0);
1432 return Status::OK();
1433 }
1434
1435 S3Model::HeadObjectRequest req;
1436 req.SetBucket(ToAwsString(path_.bucket));
1437 req.SetKey(ToAwsString(path_.key));
1438 RETURN_NOT_OK(SetSSECustomerKey(&req, sse_customer_key_));
1439
1440 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
1441 auto outcome = client_lock.Move()->HeadObject(req);
1442 if (!outcome.IsSuccess()) {
1443 if (IsNotFound(outcome.GetError())) {
1444 return PathNotFound(path_);
1445 } else {
1446 return ErrorToStatus(
1447 std::forward_as_tuple("When reading information for key '", path_.key,
1448 "' in bucket '", path_.bucket, "': "),
1449 "HeadObject", outcome.GetError());
1450 }
1451 }
1452 content_length_ = outcome.GetResult().GetContentLength();
1453 DCHECK_GE(content_length_, 0);
1454 metadata_ = GetObjectMetadata(outcome.GetResult());
1455 return Status::OK();
1456 }
1457
1458 Status CheckClosed() const {
1459 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