factorize restore

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-02-28 12:24:37 +01:00
parent 82ee2b5189
commit b5368b4e43
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 24 additions and 18 deletions

View File

@ -437,29 +437,35 @@ class Validator:
"""It restores the rows assigned to the validator, that can be repaired.""" """It restores the rows assigned to the validator, that can be repaired."""
if self.repairOnTheFly: if self.repairOnTheFly:
for id in self.rowIDs: for id in self.rowIDs:
rep = self.block.repairRow(id) self.restoreRow(id)
if (rep.any()):
# If operation is based on send queues, segments should def restoreRow(self, id):
# be queued after successful repair. rep = self.block.repairRow(id)
for i in range(len(rep)): if (rep.any()):
if rep[i]: # If operation is based on send queues, segments should
self.logger.debug("Rep: %d,%d", id, i, extra=self.format) # be queued after successful repair.
self.addToSendQueue(id, i) for i in range(len(rep)):
# self.statsRepairInSlot += rep.count(1) if rep[i]:
self.logger.debug("Rep: %d,%d", id, i, extra=self.format)
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."""
if self.repairOnTheFly: if self.repairOnTheFly:
for id in self.columnIDs: for id in self.columnIDs:
rep = self.block.repairColumn(id) self.restoreColumn(id)
if (rep.any()):
# If operation is based on send queues, segments should def restoreColumn(self, id):
# be queued after successful repair. rep = self.block.repairColumn(id)
for i in range(len(rep)): if (rep.any()):
if rep[i]: # If operation is based on send queues, segments should
self.logger.debug("Rep: %d,%d", i, id, extra=self.format) # be queued after successful repair.
self.addToSendQueue(i, id) for i in range(len(rep)):
# self.statsRepairInSlot += rep.count(1) if rep[i]:
self.logger.debug("Rep: %d,%d", i, id, extra=self.format)
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."""