| 4836 | } |
| 4837 | |
| 4838 | Reference<TCMachineTeamInfo> DDTeamCollection::checkAndCreateMachineTeam(Reference<TCTeamInfo> serverTeam) { |
| 4839 | std::vector<Standalone<StringRef>> machineIDs; |
| 4840 | for (auto& server : serverTeam->getServers()) { |
| 4841 | Reference<TCMachineInfo> machine = server->machine; |
| 4842 | machineIDs.push_back(machine->machineID); |
| 4843 | } |
| 4844 | |
| 4845 | std::sort(machineIDs.begin(), machineIDs.end()); |
| 4846 | Reference<TCMachineTeamInfo> machineTeam = findMachineTeam(machineIDs); |
| 4847 | if (!machineTeam.isValid()) { // Create the machine team if it does not exist |
| 4848 | machineTeam = addMachineTeam(machineIDs.begin(), machineIDs.end()); |
| 4849 | } |
| 4850 | |
| 4851 | machineTeam->addServerTeam(serverTeam); |
| 4852 | |
| 4853 | return machineTeam; |
| 4854 | } |
| 4855 | |
| 4856 | void DDTeamCollection::removeMachine(Reference<TCMachineInfo> removedMachineInfo) { |
| 4857 | // Find machines that share teams with the removed machine |
no test coverage detected