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