MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / _set_keyspace_for_all_pools

Method _set_keyspace_for_all_pools

cassandra/cluster.py:3399–3424  ·  view source on GitHub ↗

Asynchronously sets the keyspace on all pools. When all pools have set all of their connections, `callback` will be called with a dictionary of all errors that occurred, keyed by the `Host` that they occurred against.

(self, keyspace, callback)

Source from the content-addressed store, hash-verified

3397 self.execute('USE %s' % (protect_name(keyspace),))
3398
3399 def _set_keyspace_for_all_pools(self, keyspace, callback):
3400 """
3401 Asynchronously sets the keyspace on all pools. When all
3402 pools have set all of their connections, `callback` will be
3403 called with a dictionary of all errors that occurred, keyed
3404 by the `Host` that they occurred against.
3405 """
3406 with self._lock:
3407 self.keyspace = keyspace
3408 remaining_callbacks = set(self._pools.values())
3409 errors = {}
3410
3411 if not remaining_callbacks:
3412 callback(errors)
3413 return
3414
3415 def pool_finished_setting_keyspace(pool, host_errors):
3416 remaining_callbacks.remove(pool)
3417 if host_errors:
3418 errors[pool.host] = host_errors
3419
3420 if not remaining_callbacks:
3421 callback(host_errors)
3422
3423 for pool in tuple(self._pools.values()):
3424 pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
3425
3426 def user_type_registered(self, keyspace, user_type, klass):
3427 """

Callers 1

_set_resultMethod · 0.80

Calls 3

setFunction · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected