From cb9616af142252fa27443f1e55a84e8d64a23543 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Sat, 15 Jul 2023 02:18:30 +0200 Subject: [PATCH] Add N/K to shape Signed-off-by: Csaba Kiraly --- DAS/shape.py | 11 ++++++++--- DAS/validator.py | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/DAS/shape.py b/DAS/shape.py index 93bec3d..0af4c10 100644 --- a/DAS/shape.py +++ b/DAS/shape.py @@ -3,12 +3,15 @@ class Shape: """This class represents a set of parameters for a specific simulation.""" - def __init__(self, blockSizeR, blockSizeC, numberNodes, failureModel, failureRate, class1ratio, chiR, chiC, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run): + def __init__(self, blockSizeR, blockSizeRK, blockSizeC, blockSizeCK, + numberNodes, failureModel, failureRate, class1ratio, chiR, chiC, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run): """Initializes the shape with the parameters passed in argument.""" self.run = run self.numberNodes = numberNodes self.blockSizeR = blockSizeR + self.blockSizeRK = blockSizeRK self.blockSizeC = blockSizeC + self.blockSizeCK = blockSizeCK self.failureModel = failureModel self.failureRate = failureRate self.netDegree = netDegree @@ -25,8 +28,10 @@ class Shape: def __repr__(self): """Returns a printable representation of the shape""" shastr = "" - shastr += "bsr-"+str(self.blockSizeR) - shastr += "bsc-"+str(self.blockSizeC) + shastr += "bsrn-"+str(self.blockSizeR) + shastr += "bsrk-"+str(self.blockSizeRK) + shastr += "bscn-"+str(self.blockSizeC) + shastr += "bsck-"+str(self.blockSizeCK) shastr += "-nn-"+str(self.numberNodes) shastr += "-fm-"+str(self.failureModel) shastr += "-fr-"+str(self.failureRate) diff --git a/DAS/validator.py b/DAS/validator.py index 651f4a7..2e8312b 100644 --- a/DAS/validator.py +++ b/DAS/validator.py @@ -49,8 +49,8 @@ class Validator: FORMAT = "%(levelname)s : %(entity)s : %(message)s" self.ID = ID self.format = {"entity": "Val "+str(self.ID)} - self.block = Block(self.shape.blockSizeR, self.shape.blockSizeC) - self.receivedBlock = Block(self.shape.blockSizeR, self.shape.blockSizeC) + self.block = Block(self.shape.blockSizeR, self.shape.blockSizeRK, self.shape.blockSizeC, self.shape.blockSizeCK) + self.receivedBlock = Block(self.shape.blockSizeR, self.shape.blockSizeRK, self.shape.blockSizeC, self.shape.blockSizeCK) self.receivedQueue = deque() self.sendQueue = deque() self.amIproposer = amIproposer @@ -101,8 +101,8 @@ class Validator: self.bwUplink *= 1e3 / 8 * config.stepDuration / config.segmentSize self.repairOnTheFly = True - self.sendLineUntilR = (self.shape.blockSizeR + 1) // 2 # stop sending on a p2p link if at least this amount of samples passed - self.sendLineUntilC = (self.shape.blockSizeC + 1) // 2 # stop sending on a p2p link if at least this amount of samples passed + self.sendLineUntilR = self.shape.blockSizeRK # stop sending on a p2p link if at least this amount of samples passed + self.sendLineUntilC = self.shape.blockSizeCK # stop sending on a p2p link if at least this amount of samples passed self.perNeighborQueue = True # queue incoming messages to outgoing connections on arrival (as typical GossipSub impl) self.shuffleQueues = True # shuffle the order of picking from active queues of a sender node self.perNodeQueue = False # keep a global queue of incoming messages for later sequential dispatch