| 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_) { |
nothing calls this directly
no test coverage detected