Beispiel #1
0
 def doIOwn(self, key):
     """
     Looks to see if I own some key.
     If seek returns myself, then I'm the closest
     """
     point = space.idToPoint(key)
     return space.isPointBetweenRightInclusive(point, self.predecessor.loc, self.loc)
Beispiel #2
0
 def doesMySuccessorOwn(self, key):
     """
     Does my successor own this key
     """
     point = space.idToPoint(key)
     return space.isPointBetweenRightInclusive(point, self.loc,
                                               self.succList[0].loc)
Beispiel #3
0
 def doIOwn(self, key):
     """
     Looks to see if I own some key.
     If seek returns myself, then I'm the closest
     """
     point = space.idToPoint(key)
     return space.isPointBetweenRightInclusive(point, self.predecessor.loc,
                                               self.loc)
Beispiel #4
0
    def lookup(self, key):
        """
        Iterative lookup of key

        key:  a multihash key
        returns -> node responsible for key
        """
        loc = space.idToPoint(key)
        return self.lookupPoint(loc)
Beispiel #5
0
    def lookup(self, key):
        """
        Iterative lookup of key

        key:  a multihash key
        returns -> node responsible for key
        """
        loc = space.idToPoint(key)
        return self.lookupPoint(loc)
Beispiel #6
0
 def __init__(self, peerinfo, key):
     self.network = None
     self.database = None
     self.key = key      # TODO Rename key
     self.predecessor = None
     self.succList = []
     self.shortPeers = [self.predecessor, self.succList]
     self.longPeers = []
     # self.seekCandidates = []
     self.notifiedMe = []
     self.info = peerinfo
     if peerinfo.loc is None:
         self.loc = space.idToPoint(self.info.id)
         self.info.loc = self.loc
     else:
         self.loc = peerinfo.loc
     self.janitorThread = None
     self.shortcutThread = None
     self.peersLock = threading.RLock()
     self.notifiedLock = threading.RLock()
Beispiel #7
0
 def __init__(self, peerinfo, key):
     self.network = None
     self.database = None
     self.key = key  # TODO Rename key
     self.predecessor = None
     self.succList = []
     self.shortPeers = [self.predecessor, self.succList]
     self.longPeers = []
     # self.seekCandidates = []
     self.notifiedMe = []
     self.info = peerinfo
     if peerinfo.loc is None:
         self.loc = space.idToPoint(self.info.id)
         self.info.loc = self.loc
     else:
         self.loc = peerinfo.loc
     self.janitorThread = None
     self.shortcutThread = None
     self.peersLock = threading.RLock()
     self.notifiedLock = threading.RLock()
Beispiel #8
0
 def seek(self, key):
     """
     Returns the node I know either responsible for or closest to key
     """
     loc = space.idToPoint(key)
     return self.seekPoint(loc)
Beispiel #9
0
 def doesMySuccessorOwn(self, key):
     """
     Does my successor own this key
     """
     point = space.idToPoint(key)
     return space.isPointBetweenRightInclusive(point, self.loc, self.succList[0].loc)
Beispiel #10
0
 def seek(self, key):
     """
     Returns the node I know either responsible for or closest to key
     """
     loc = space.idToPoint(key)
     return self.seekPoint(loc)