MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateDir

Method CreateDir

tensorflow/core/platform/s3/s3_file_system.cc:521–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521Status S3FileSystem::CreateDir(const string& dirname) {
522 string bucket, object;
523 TF_RETURN_IF_ERROR(ParseS3Path(dirname, true, &bucket, &object));
524
525 if (object.empty()) {
526 Aws::S3::Model::HeadBucketRequest headBucketRequest;
527 headBucketRequest.WithBucket(bucket.c_str());
528 auto headBucketOutcome = this->GetS3Client()->HeadBucket(headBucketRequest);
529 if (!headBucketOutcome.IsSuccess()) {
530 return errors::NotFound("The bucket ", bucket, " was not found.");
531 }
532 return Status::OK();
533 }
534 string filename = dirname;
535 if (filename.back() != '/') {
536 filename.push_back('/');
537 }
538 std::unique_ptr<WritableFile> file;
539 TF_RETURN_IF_ERROR(NewWritableFile(filename, &file));
540 TF_RETURN_IF_ERROR(file->Close());
541 return Status::OK();
542}
543
544Status S3FileSystem::DeleteDir(const string& dirname) {
545 string bucket, object;

Callers 1

TEST_FFunction · 0.45

Calls 8

GetS3ClientMethod · 0.95
ParseS3PathFunction · 0.85
NotFoundFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45
push_backMethod · 0.45
CloseMethod · 0.45

Tested by 1

TEST_FFunction · 0.36