def _packetAcked(self, packet, ownerID, packetID): from storage import backup_matrix backupID, blockNum, supplierNum, dataORparity = packetid.BidBnSnDp(packetID) backup_matrix.RemoteFileReport( backupID, blockNum, supplierNum, dataORparity, True) if ownerID not in self.statistic: self.statistic[ownerID] = [0, 0] self.statistic[ownerID][0] += 1 self.automat('block-acked', (ownerID, packetID))
def _packetFailed(self, remoteID, packetID, why): from storage import backup_matrix backupID, blockNum, supplierNum, dataORparity = packetid.BidBnSnDp( packetID) backup_matrix.RemoteFileReport(backupID, blockNum, supplierNum, dataORparity, False) if remoteID not in self.statistic: self.statistic[remoteID] = [0, 0] self.statistic[remoteID][1] += 1 self.automat('block-failed', (remoteID, packetID))
def _packetFailed(self, remoteID, packetID, why): from storage import backup_matrix backupID, blockNum, supplierNum, dataORparity = packetid.BidBnSnDp( packetID) backup_matrix.RemoteFileReport(backupID, blockNum, supplierNum, dataORparity, False) if remoteID not in self.statistic: self.statistic[remoteID] = { 'acked': 0, 'failed': 0, 'latest': '', } self.statistic[remoteID]['failed'] += 1 self.statistic[remoteID]['latest'] += '-' self.statistic[remoteID]['latest'] = self.statistic[remoteID][ 'latest'][-STAT_KEEP_LATEST_RESULTS_COUNT:] self.automat('block-failed', (remoteID, packetID))
def _packetAcked(self, packet, ownerID, packetID): from storage import backup_matrix backupID, blockNum, supplierNum, dataORparity = packetid.BidBnSnDp( packetID) backup_matrix.RemoteFileReport(backupID, blockNum, supplierNum, dataORparity, True) if ownerID not in self.statistic: self.statistic[ownerID] = { 'acked': 0, 'failed': 0, 'latest': '', } self.statistic[ownerID]['acked'] += 1 self.statistic[ownerID]['latest'] += '+' self.statistic[ownerID]['latest'] = self.statistic[ownerID]['latest'][ -STAT_KEEP_LATEST_RESULTS_COUNT:] self.automat('block-acked', (ownerID, packetID))