MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / isDoneForToken

Function isDoneForToken

lib/metadata/schema-parser.js:1138–1153  ·  view source on GitHub ↗
(replicationFactors, datacenters, replicasByDc)

Source from the content-addressed store, hash-verified

1136}
1137
1138function 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

Callers 2

metadata-tests.jsFile · 0.85

Calls 1

keysMethod · 0.65

Tested by

no test coverage detected