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

Method GetS3Client

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

Initializes s3_client_, if needed, and returns it.

Source from the content-addressed store, hash-verified

296
297// Initializes s3_client_, if needed, and returns it.
298std::shared_ptr<Aws::S3::S3Client> S3FileSystem::GetS3Client() {
299 std::lock_guard<mutex> lock(this->client_lock_);
300
301 if (this->s3_client_.get() == nullptr) {
302 AWSLogSystem::InitializeAWSLogging();
303
304 Aws::SDKOptions options;
305 options.cryptoOptions.sha256Factory_create_fn = []() {
306 return Aws::MakeShared<AWSSHA256Factory>(AWSCryptoAllocationTag);
307 };
308 options.cryptoOptions.sha256HMACFactory_create_fn = []() {
309 return Aws::MakeShared<AWSSHA256HmacFactory>(AWSCryptoAllocationTag);
310 };
311 Aws::InitAPI(options);
312
313 // The creation of S3Client disables virtual addressing:
314 // S3Client(clientConfiguration, signPayloads, useVirtualAdressing = true)
315 // The purpose is to address the issue encountered when there is an `.`
316 // in the bucket name. Due to TLS hostname validation or DNS rules,
317 // the bucket may not be resolved. Disabling of virtual addressing
318 // should address the issue. See GitHub issue 16397 for details.
319 this->s3_client_ = std::shared_ptr<Aws::S3::S3Client>(new Aws::S3::S3Client(
320 GetDefaultClientConfig(),
321 Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, false));
322 }
323
324 return this->s3_client_;
325}
326
327Status S3FileSystem::NewRandomAccessFile(
328 const string& fname, std::unique_ptr<RandomAccessFile>* result) {

Callers 9

NewRandomAccessFileMethod · 0.95
NewWritableFileMethod · 0.95
NewAppendableFileMethod · 0.95
GetChildrenMethod · 0.95
StatMethod · 0.95
DeleteFileMethod · 0.95
CreateDirMethod · 0.95
DeleteDirMethod · 0.95
RenameFileMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected