| 115 | }; |
| 116 | |
| 117 | struct DataDistributorSingleton : Singleton<DataDistributorInterface> { |
| 118 | |
| 119 | DataDistributorSingleton(const Optional<DataDistributorInterface>& interface) : Singleton(interface) {} |
| 120 | |
| 121 | Role getRole() const { return Role::DATA_DISTRIBUTOR; } |
| 122 | ProcessClass::ClusterRole getClusterRole() const { return ProcessClass::DataDistributor; } |
| 123 | |
| 124 | void setInterfaceToDbInfo(ClusterControllerData* cc) const { |
| 125 | if (interface.present()) { |
| 126 | TraceEvent("CCDD_SetInf", cc->id).detail("Id", interface.get().id()); |
| 127 | cc->db.setDistributor(interface.get()); |
| 128 | } |
| 129 | } |
| 130 | void halt(ClusterControllerData* cc, Optional<Standalone<StringRef>> pid) const { |
| 131 | if (interface.present() && cc->id_worker.count(pid)) { |
| 132 | cc->id_worker[pid].haltDistributor = |
| 133 | brokenPromiseToNever(interface.get().haltDataDistributor.getReply(HaltDataDistributorRequest(cc->id))); |
| 134 | } |
| 135 | } |
| 136 | void recruit(ClusterControllerData* cc) const { |
| 137 | cc->lastRecruitTime = now(); |
| 138 | cc->recruitDistributor.set(true); |
| 139 | } |
| 140 | }; |
| 141 | |
| 142 | struct BlobManagerSingleton : Singleton<BlobManagerInterface> { |
| 143 |
no outgoing calls
no test coverage detected