(replicationFactors, datacenters, replicasByDc)
| 1136 | } |
| 1137 | |
| 1138 | function isDoneForToken(replicationFactors, datacenters, replicasByDc) { |
| 1139 | const keys = Object.keys(replicationFactors); |
| 1140 | for (let i = 0; i < keys.length; i++) { |
| 1141 | const dcName = keys[i]; |
| 1142 | const dc = datacenters[dcName]; |
| 1143 | if (!dc) { |
| 1144 | // A DC is included in the RF but the DC does not exist in the topology |
| 1145 | continue; |
| 1146 | } |
| 1147 | const rf = Math.min(parseInt(replicationFactors[dcName], 10), dc.hostLength); |
| 1148 | if (rf > 0 && (!replicasByDc[dcName] || replicasByDc[dcName] < rf)) { |
| 1149 | return false; |
| 1150 | } |
| 1151 | } |
| 1152 | return true; |
| 1153 | } |
| 1154 | |
| 1155 | /** |
| 1156 | * Creates a new instance if the currentInstance is not valid for the |
no test coverage detected