def send(self): """ 1. consider the network constraints and send out the msgs 2. for each tweet, construct the follower set 3. generate the multicasting tree 4. do the redundency """ self.accOut += self.netOut self.curNetOut = 0 data = self.get_from_out_buf() while data: timestamp, msgID, u, msgLen = data x1 = self.userNodes[u.id].x y1 = self.userNodes[u.id].y delay = Util.delay(self.x, self.y, x1, y1) #net = Util.net(self.x, self.y, x1, y1) #delay += ((u.subTreeSize + msgLen ) / net ) self.userNodes[u.id].put_to_in_buf(self.timer.cur_time() + delay, timestamp, msgID, u, msgLen) data = self.get_from_out_buf()
def send(self): """ 0. inc accOut budget 1. read from outBuf (consider both cpu and network constraints) 2. append to receivers' inBuf """ self.accOut += self.netOut self.curNetOut = 0 data = self.get_from_out_buf() while data: prevDelay, timestamp, msgID, peerList, msgLen = data #Arr... there is some redundancy here, both self.userNodes[u.id].x and u.x refers to the same thing for peerID in peerList: x1 = self.userNodes[peerID].x y1 = self.userNodes[peerID].y delay = self.p2pHops * Util.delay(self.x, self.y, x1, y1) net = Util.net(self.x, self.y, x1, y1) delay += (msgLen / net ) #print prevDelay + delay self.userNodes[peerID].put_to_in_buf(prevDelay + delay, timestamp, msgID, msgLen) del peerList data = self.get_from_out_buf()
def send(self): """ 0. inc accOut budget 1. read from outBuf (consider both cpu and network constraints) 2. append to receivers' inBuf """ self.accOut += self.netOut self.curNetOut = 0 data = self.get_from_out_buf() while data: prevDelay, timestamp, msgID, u, msgLen = data #Arr... there is some redundancy here, both self.userNodes[u.id].x and u.x refers to the same thing x1 = self.userNodes[u.id].x y1 = self.userNodes[u.id].y delay = Util.delay(self.x, self.y, x1, y1) net = Util.net(self.x, self.y, x1, y1) delay += ((u.subTreeSize + msgLen ) / net ) #print ("send delay", delay) #print (self.x, self.y, x1, y1, delay) #ASSERTION: cur_time() should be in seconds (float) self.userNodes[u.id].put_to_in_buf(prevDelay + delay, timestamp, msgID, u, msgLen) data = self.get_from_out_buf()