本文整理汇总了Python中cassandra.policies.RoundRobinPolicy.make_query_plan方法的典型用法代码示例。如果您正苦于以下问题:Python RoundRobinPolicy.make_query_plan方法的具体用法?Python RoundRobinPolicy.make_query_plan怎么用?Python RoundRobinPolicy.make_query_plan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cassandra.policies.RoundRobinPolicy
的用法示例。
在下文中一共展示了RoundRobinPolicy.make_query_plan方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_query_plans
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_multiple_query_plans(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
for i in xrange(20):
qplan = list(policy.make_query_plan())
self.assertEqual(sorted(qplan), hosts)
示例2: test_status_updates
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_status_updates(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
policy.on_down(0)
policy.on_remove(1)
policy.on_up(4)
policy.on_add(5)
qplan = list(policy.make_query_plan())
self.assertEqual(sorted(qplan), [2, 3, 4, 5])
示例3: test_no_live_nodes
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_no_live_nodes(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
for i in range(4):
policy.on_down(i)
query_plan = list(policy.make_query_plan())
self.assertEqual(query_plan, [])
示例4: test_no_live_nodes
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_no_live_nodes(self):
"""
Ensure query plan for a downed cluster will execute without errors
"""
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
for i in range(4):
policy.on_down(i)
qplan = list(policy.make_query_plan())
self.assertEqual(qplan, [])
示例5: test_single_host
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_single_host(self):
policy = RoundRobinPolicy()
policy.populate(None, [0])
qplan = list(policy.make_query_plan())
self.assertEqual(qplan, [0])
示例6: test_basic
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import make_query_plan [as 别名]
def test_basic(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
qplan = list(policy.make_query_plan())
self.assertEqual(sorted(qplan), hosts)