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

Method BucketExists

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

Tests to see if a bucket exists

Source from the content-addressed store, hash-verified

2242
2243 // Tests to see if a bucket exists
2244 Result<bool> BucketExists(const std::string& bucket) {
2245 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
2246
2247 S3Model::HeadBucketRequest req;
2248 req.SetBucket(ToAwsString(bucket));
2249
2250 auto outcome = client_lock.Move()->HeadBucket(req);
2251 if (!outcome.IsSuccess()) {
2252 if (!IsNotFound(outcome.GetError())) {
2253 return ErrorToStatus(std::forward_as_tuple(
2254 "When testing for existence of bucket '", bucket, "': "),
2255 "HeadBucket", outcome.GetError());
2256 }
2257 return false;
2258 }
2259 return true;
2260 }
2261
2262 // Create a bucket. Successful if bucket already exists.
2263 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