示例#1
0
 def __init__(self, IPAddr, ctrlPort, key=None):
     if key is None:
         self.key = hash_str(IPAddr + ":" + str(ctrlPort))
     else:
         self.key = key
     self.loc = spacemath.hash2loc(self.key)
     self.IPAddr = IPAddr
     self.ctrlPort = ctrlPort
示例#2
0
def I_own_hash(hkey):
    return thisNode == spacemath.v_filter(spacemath.hash2loc(hkey), [thisNode] + peers)
示例#3
0
def find_ideal_forward(key):
    ##print key
    return spacemath.v_filter(spacemath.hash2loc(key), peers + [thisNode])