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

Method _prepareOnAllHosts

lib/prepare-handler.js:283–296  ·  view source on GitHub ↗

* Prepares the provided query on all hosts, except the host provided. * @param {Iterator} iterator * @param {String} query * @param {String} keyspace * @private

(iterator, query, keyspace)

Source from the content-addressed store, hash-verified

281 * @private
282 */
283 _prepareOnAllHosts(iterator, query, keyspace) {
284 const queries = [ query ];
285 let h;
286 const hosts = [];
287
288 while ((h = PrepareHandler.getNextHost(iterator, this._client.profileManager)) !== null) {
289 hosts.push(h);
290 }
291
292 return Promise.all(hosts.map(h =>
293 PrepareHandler
294 ._borrowAndPrepare(h, keyspace, queries)
295 .catch(err => this.log('verbose', `Unexpected error while preparing query (${query}) on ${h.address}`, err))));
296 }
297}
298
299module.exports = PrepareHandler;

Callers 1

_prepareWithQueryPlanMethod · 0.95

Calls 3

getNextHostMethod · 0.80
_borrowAndPrepareMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected