本文整理汇总了Python中framework.Framework.setNodes方法的典型用法代码示例。如果您正苦于以下问题:Python Framework.setNodes方法的具体用法?Python Framework.setNodes怎么用?Python Framework.setNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类framework.Framework
的用法示例。
在下文中一共展示了Framework.setNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import setNodes [as 别名]
def __init__(self, addr, config_file='server_config'):
super(DynamoNode, self).__init__()
self.local_store = MerkleTree() # key => (value, metadata)
self.pending_put_rsp = {} # seqno => set of nodes that have stored
self.pending_put_msg = {} # seqno => original client message
self.pending_get_rsp = {} # seqno => set of (node, value, metadata) tuples
self.pending_get_msg = {} # seqno => original client message
# seqno => set of requests sent to other nodes, for each message class
self.pending_req = {PutReq: {}, GetReq: {}}
self.failed_nodes = []
self.pending_handoffs = {}
# Rebuild the consistent hash table
self.addr = addr
self.servers = []
self.db = leveldb.LevelDB('./' + addr + '_db')
f = open(config_file, 'r')
for line in f.readlines():
line = line.rstrip()
self.servers.append(line)
for i, server in enumerate(self.servers):
DynamoNode.nodelist.append(server)
DynamoNode.chash = ConsistentHashTable(DynamoNode.nodelist, DynamoNode.T)
# Run a timer to retry failed nodes
#self.pool = gevent.pool.Group()
#self.pool.spawn(self.retry_failed_node)
Framework.setNodes(DynamoNode.nodelist)