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

Method AddClient

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

Source from the content-addressed store, hash-verified

905
906 public:
907 Result<std::shared_ptr<S3ClientHolder>> AddClient(std::shared_ptr<S3Client> client) {
908 std::unique_lock lock(mutex_);
909 if (finalized_) {
910 return ErrorS3Finalized();
911 }
912
913 auto holder = std::make_shared<S3ClientHolder>(shared_from_this(), std::move(client));
914
915 // Remove expired entries before adding new one
916 auto end = std::remove_if(
917 holders_.begin(), holders_.end(),
918 [](std::weak_ptr<S3ClientHolder> holder) { return holder.expired(); });
919 holders_.erase(end, holders_.end());
920 holders_.emplace_back(holder);
921 return holder;
922 }
923
924 void Finalize() {
925 std::unique_lock lock(mutex_);

Callers 1

GetClientHolderFunction · 0.80

Calls 4

ErrorS3FinalizedFunction · 0.85
emplace_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected