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

Method BucketExists

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

Tests to see if a bucket exists

Source from the content-addressed store, hash-verified

2301
2302 // Tests to see if a bucket exists
2303 Result<bool> BucketExists(const std::string& bucket) {
2304 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
2305
2306 S3Model::HeadBucketRequest req;
2307 req.SetBucket(ToAwsString(bucket));
2308
2309 auto outcome = client_lock.Move()->HeadBucket(req);
2310 if (!outcome.IsSuccess()) {
2311 if (!IsNotFound(outcome.GetError())) {
2312 return ErrorToStatus(std::forward_as_tuple(
2313 "When testing for existence of bucket '", bucket, "': "),
2314 "HeadBucket", outcome.GetError());
2315 }
2316 return false;
2317 }
2318 return true;
2319 }
2320
2321 // Create a bucket. Successful if bucket already exists.
2322 Status CreateBucket(const std::string& bucket) {

Callers

nothing calls this directly

Calls 4

ToAwsStringFunction · 0.85
IsNotFoundFunction · 0.85
ErrorToStatusFunction · 0.85
MoveMethod · 0.45

Tested by

no test coverage detected