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

Method BucketExists

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

Tests to see if a bucket exists

Source from the content-addressed store, hash-verified

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