mirror of
https://github.com/logos-storage/das-research.git
synced 2026-01-06 15:13:13 +00:00
WIP: minimal sample generation and check
This is early WIP, it only checks if neighbors would be able to provide all the samples needed by nodes. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
bb6f3e80b4
commit
f8d5bfbb30
27
DAS/node.py
27
DAS/node.py
@ -115,6 +115,7 @@ class Node:
|
||||
self.bwUplink = shape.bwUplink2
|
||||
self.bwUplink *= 1e3 / 8 * config.stepDuration / config.segmentSize
|
||||
|
||||
self.DASampleSize = 10 # TODO make this an external parameter
|
||||
self.repairOnTheFly = True
|
||||
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
|
||||
@ -159,6 +160,32 @@ class Node:
|
||||
if symmetric:
|
||||
peer.columnNeighbors[lineID].update({self.ID : p})
|
||||
|
||||
def getNeighbors(self):
|
||||
"""Collect all neighbors (WIP, to be cached)"""
|
||||
nn = set()
|
||||
for neighs in self.rowNeighbors.values():
|
||||
for n in neighs.values():
|
||||
nn.add(n.peer.node)
|
||||
for neighs in self.columnNeighbors.values():
|
||||
for n in neighs.values():
|
||||
nn.add(n.peer.node)
|
||||
|
||||
return nn
|
||||
def initDAS(self):
|
||||
""" Minimal sample init function"""
|
||||
self.DASample = [(random.randrange(self.shape.blockSizeC), random.randrange(self.shape.blockSizeR))
|
||||
for i in range(self.DASampleSize)]
|
||||
|
||||
def checkDAS(self):
|
||||
""" Dumb check in all neighbors without messaging """
|
||||
block = Block.copy(self.block)
|
||||
for neigh in self.getNeighbors():
|
||||
block.merge(neigh.block)
|
||||
found = 0
|
||||
for rid, cid in self.DASample:
|
||||
found += block.getSegment(rid, cid)
|
||||
self.logger.debug("DAS found: %d / %d", found, self.DASampleSize, extra=self.format)
|
||||
return (found, self.DASampleSize)
|
||||
|
||||
def logIDs(self):
|
||||
"""It logs the assigned rows and columns."""
|
||||
|
||||
@ -247,6 +247,8 @@ class Simulator:
|
||||
progressVector = []
|
||||
trafficStatsVector = []
|
||||
steps = 0
|
||||
for i in range(1,self.shape.numberNodes):
|
||||
self.validators[i].initDAS()
|
||||
while(True):
|
||||
missingVector.append(missingSamples)
|
||||
oldMissingSamples = missingSamples
|
||||
@ -264,6 +266,8 @@ class Simulator:
|
||||
for i in range(0,self.shape.numberNodes):
|
||||
self.validators[i].logRows()
|
||||
self.validators[i].logColumns()
|
||||
for i in range(1,self.shape.numberNodes):
|
||||
self.validators[i].checkDAS()
|
||||
|
||||
# log TX and RX statistics
|
||||
trafficStats = self.glob.getTrafficStats(self.validators)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user