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
def I_own_hash(hkey): return thisNode == spacemath.v_filter(spacemath.hash2loc(hkey), [thisNode] + peers)
def find_ideal_forward(key): ##print key return spacemath.v_filter(spacemath.hash2loc(key), peers + [thisNode])