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

Method MergeInto

cpp/src/arrow/filesystem/filesystem.cc:755–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753 }
754
755 Status MergeInto(FileSystemFactoryRegistry* main_registry) {
756 std::unique_lock lock{mutex_};
757 RETURN_NOT_OK(CheckValid());
758
759 std::unique_lock main_lock{main_registry->mutex_};
760 RETURN_NOT_OK(main_registry->CheckValid());
761
762 std::vector<std::string_view> duplicated_schemes;
763 for (auto& [scheme, registered] : scheme_to_factory_) {
764 if (!registered.ok()) {
765 duplicated_schemes.emplace_back(scheme);
766 continue;
767 }
768
769 auto [it, success] =
770 main_registry->scheme_to_factory_.emplace(std::move(scheme), registered);
771 if (success) continue;
772
773 if (it->second.ok()) {
774 if (registered->factory == it->second->factory) continue;
775 }
776
777 duplicated_schemes.emplace_back(it->first);
778 }
779 scheme_to_factory_.clear();
780 merged_into_ = main_registry;
781
782 if (duplicated_schemes.empty()) return Status::OK();
783 return Status::KeyError("Attempted to register ", duplicated_schemes.size(),
784 " factories for schemes ['",
785 arrow::internal::JoinStrings(duplicated_schemes, "', '"),
786 "'] but those schemes were already registered.");
787 }
788
789 void EnsureFinalized() {
790 std::unique_lock lock{mutex_};

Callers 1

LoadFileSystemFactoriesFunction · 0.80

Calls 9

KeyErrorFunction · 0.85
JoinStringsFunction · 0.85
emplace_backMethod · 0.80
OKFunction · 0.50
CheckValidMethod · 0.45
okMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected