| 720 | } |
| 721 | |
| 722 | Status Unregister(const std::string& scheme) { |
| 723 | std::shared_lock lock{mutex_}; |
| 724 | RETURN_NOT_OK(CheckValid()); |
| 725 | |
| 726 | auto it = scheme_to_factory_.find(scheme); |
| 727 | if (it == scheme_to_factory_.end()) { |
| 728 | return Status::KeyError("No factories found for scheme ", scheme, |
| 729 | ", can't unregister"); |
| 730 | } |
| 731 | |
| 732 | std::function<void()> finalizer; |
| 733 | if (it->second.ok()) { |
| 734 | finalizer = it->second.ValueOrDie().finalizer; |
| 735 | } |
| 736 | scheme_to_factory_.erase(it); |
| 737 | lock.unlock(); |
| 738 | |
| 739 | if (finalizer) { |
| 740 | finalizer(); |
| 741 | } |
| 742 | return Status::OK(); |
| 743 | } |
| 744 | |
| 745 | Result<const FileSystemFactory*> FactoryForScheme(const std::string& scheme) { |
| 746 | std::shared_lock lock{mutex_}; |
no test coverage detected