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

Method update_created_pools

cassandra/cluster.py:3346–3377  ·  view source on GitHub ↗

When the set of live nodes change, the loadbalancer will change its mind on host distances. It might change it on the node that came/left but also on other nodes (for instance, if a node dies, another previously ignored node may be now considered). This meth

(self)

Source from the content-addressed store, hash-verified

3344 return None
3345
3346 def update_created_pools(self):
3347 """
3348 When the set of live nodes change, the loadbalancer will change its
3349 mind on host distances. It might change it on the node that came/left
3350 but also on other nodes (for instance, if a node dies, another
3351 previously ignored node may be now considered).
3352
3353 This method ensures that all hosts for which a pool should exist
3354 have one, and hosts that shouldn't don't.
3355
3356 For internal use only.
3357 """
3358 futures = set()
3359 for host in self.cluster.metadata.all_hosts():
3360 distance = self._profile_manager.distance(host)
3361 pool = self._pools.get(host)
3362 future = None
3363 if not pool or pool.is_shutdown:
3364 # we don't eagerly set is_up on previously ignored hosts. None is included here
3365 # to allow us to attempt connections to hosts that have gone from ignored to something
3366 # else.
3367 if distance != HostDistance.IGNORED and host.is_up in (True, None):
3368 future = self.add_or_renew_pool(host, False)
3369 elif distance != pool.host_distance:
3370 # the distance has changed
3371 if distance == HostDistance.IGNORED:
3372 future = self.remove_pool(host)
3373 else:
3374 pool.host_distance = distance
3375 if future:
3376 futures.add(future)
3377 return futures
3378
3379 def on_down(self, host):
3380 """

Callers 5

on_downMethod · 0.95
add_execution_profileMethod · 0.80
_finalize_addMethod · 0.80

Calls 7

add_or_renew_poolMethod · 0.95
remove_poolMethod · 0.95
setFunction · 0.85
all_hostsMethod · 0.45
distanceMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by 1