Changeset View
Changeset View
Standalone View
Standalone View
contrib/linearize/linearize-data.py
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | def run(self): | ||||
# If there is space in the cache, read the data | # If there is space in the cache, read the data | ||||
# Reading the data in file sequence instead of seeking and fetching it later is preferred, | # Reading the data in file sequence instead of seeking and fetching it later is preferred, | ||||
# but we don't want to fill up memory | # but we don't want to fill up memory | ||||
self.outOfOrderData[blkHeight] = self.inF.read(inLen) | self.outOfOrderData[blkHeight] = self.inF.read(inLen) | ||||
self.outOfOrderSize += inLen | self.outOfOrderSize += inLen | ||||
else: # If no space in cache, seek forward | else: # If no space in cache, seek forward | ||||
self.inF.seek(inLen, os.SEEK_CUR) | self.inF.seek(inLen, os.SEEK_CUR) | ||||
print("Done ({} blocks written)".format((self.blkCountOut))) | print("Done ({} blocks written)".format(self.blkCountOut)) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
if len(sys.argv) != 2: | if len(sys.argv) != 2: | ||||
print("Usage: linearize-data.py CONFIG-FILE") | print("Usage: linearize-data.py CONFIG-FILE") | ||||
sys.exit(1) | sys.exit(1) | ||||
f = open(sys.argv[1], encoding="utf8") | f = open(sys.argv[1], encoding="utf8") | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |