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

Method AddClient

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

Source from the content-addressed store, hash-verified

845
846 public:
847 Result<std::shared_ptr<S3ClientHolder>> AddClient(std::shared_ptr<S3Client> client) {
848 std::unique_lock lock(mutex_);
849 if (finalized_) {
850 return ErrorS3Finalized();
851 }
852
853 auto holder = std::make_shared<S3ClientHolder>(shared_from_this(), std::move(client));
854
855 // Remove expired entries before adding new one
856 auto end = std::remove_if(
857 holders_.begin(), holders_.end(),
858 [](std::weak_ptr<S3ClientHolder> holder) { return holder.expired(); });
859 holders_.erase(end, holders_.end());
860 holders_.emplace_back(holder);
861 return holder;
862 }
863
864 void Finalize() {
865 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