add repairOnTheFly parameter

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-02-15 03:23:39 +01:00
parent f05c3cd233
commit d0641e4568
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E

View File

@ -121,6 +121,7 @@ class Validator:
# TODO: this should be a parameter # TODO: this should be a parameter
self.bwUplink = 110 if not self.amIproposer else 2200 # approx. 10Mbps and 200Mbps self.bwUplink = 110 if not self.amIproposer else 2200 # approx. 10Mbps and 200Mbps
self.repairOnTheFly = True
self.perNeighborQueue = False # queue incoming messages to outgoing connections on arrival (as typical GossipSub impl) self.perNeighborQueue = False # queue incoming messages to outgoing connections on arrival (as typical GossipSub impl)
self.perNodeQueue = False # keep a global queue of incoming messages for later sequential dispatch self.perNodeQueue = False # keep a global queue of incoming messages for later sequential dispatch
self.dumbRandomScheduler = False # dumb random scheduler self.dumbRandomScheduler = False # dumb random scheduler
@ -445,29 +446,31 @@ class Validator:
def restoreRows(self): def restoreRows(self):
"""It restores the rows assigned to the validator, that can be repaired.""" """It restores the rows assigned to the validator, that can be repaired."""
for id in self.rowIDs: if self.repairOnTheFly:
rep = self.block.repairRow(id) for id in self.rowIDs:
if (rep.any()): rep = self.block.repairRow(id)
# If operation is based on send queues, segments should if (rep.any()):
# be queued after successful repair. # If operation is based on send queues, segments should
for i in range(len(rep)): # be queued after successful repair.
if rep[i]: for i in range(len(rep)):
self.logger.debug("Rep: %d,%d", id, i, extra=self.format) if rep[i]:
self.addToSendQueue(id, i) self.logger.debug("Rep: %d,%d", id, i, extra=self.format)
# self.statsRepairInSlot += rep.count(1) self.addToSendQueue(id, i)
# self.statsRepairInSlot += rep.count(1)
def restoreColumns(self): def restoreColumns(self):
"""It restores the columns assigned to the validator, that can be repaired.""" """It restores the columns assigned to the validator, that can be repaired."""
for id in self.columnIDs: if self.repairOnTheFly:
rep = self.block.repairColumn(id) for id in self.columnIDs:
if (rep.any()): rep = self.block.repairColumn(id)
# If operation is based on send queues, segments should if (rep.any()):
# be queued after successful repair. # If operation is based on send queues, segments should
for i in range(len(rep)): # be queued after successful repair.
if rep[i]: for i in range(len(rep)):
self.logger.debug("Rep: %d,%d", i, id, extra=self.format) if rep[i]:
self.addToSendQueue(i, id) self.logger.debug("Rep: %d,%d", i, id, extra=self.format)
# self.statsRepairInSlot += rep.count(1) self.addToSendQueue(i, id)
# self.statsRepairInSlot += rep.count(1)
def checkStatus(self): def checkStatus(self):
"""It checks how many expected/arrived samples are for each assigned row/column.""" """It checks how many expected/arrived samples are for each assigned row/column."""