Class: AllowListPolicy

policies/loadBalancing~AllowListPolicy(childPolicy, allowList)

A load balancing policy wrapper that ensure that only hosts from a provided allow list will ever be returned.

This policy wraps another load balancing policy and will delegate the choice of hosts to the wrapped policy with the exception that only hosts contained in the allow list provided when constructing this policy will ever be returned. Any host not in the while list will be considered ignored and thus will not be connected to.

This policy can be useful to ensure that the driver only connects to a predefined set of hosts. Keep in mind however that this policy defeats somewhat the host auto-detection of the driver. As such, this policy is only useful in a few special cases or for testing, but is not optimal in general. If all you want to do is limiting connections to hosts of the local data-center then you should use DCAwareRoundRobinPolicy and not this policy in particular.

Constructor

new AllowListPolicy(childPolicy, allowList)

Create a new policy that wraps the provided child policy but only "allow" hosts from the provided list.

Parameters:
Name Type Description
childPolicy LoadBalancingPolicy

the wrapped policy. If the child policy filters some of the hosts out, only hosts present in allow list and accepted by child policy will be contacted by the driver.

allowList Array.<string>

The hosts address in the format ipAddress:port. Only hosts from this list may get connected to (whether they will get connected to or not depends on the child policy).

Source:

Extends

  • LoadBalancingPolicy

Methods

getOptions()

Gets an associative array containing the policy options.

Source:

getRustConfiguration() → {LoadBalancingConfig}

Source:
Returns:
Type
LoadBalancingConfig