Created
December 23, 2015 20:41
-
-
Save tbarbugli/a02a78ff7aa2886a7c13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cassandra.policies import DCAwareRoundRobinPolicy | |
from cassandra.policies import HostDistance | |
from IPy import IP | |
class LocalNetworkDCAwareRoundRobinPolicy(DCAwareRoundRobinPolicy): | |
def distance(self, host): | |
host_distance = super(LocalNetworkDCAwareRoundRobinPolicy, self).distance(host) | |
if IP(host.address).iptype() == 'PUBLIC': | |
return HostDistance.IGNORED | |
return host_distance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment