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

Method Init

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

Source from the content-addressed store, hash-verified

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