MCPcopy Create free account
hub / github.com/ElementsProject/elements / __init__

Method __init__

contrib/linearize/linearize-data.py:123–154  ·  view source on GitHub ↗
(self, settings, blkindex, blkmap)

Source from the content-addressed store, hash-verified

121
122class BlockDataCopier:
123 def __init__(self, settings, blkindex, blkmap):
124 self.settings = settings
125 self.blkindex = blkindex
126 self.blkmap = blkmap
127
128 # Get first occurring block file id - for pruned nodes this
129 # will not necessarily be 0
130 self.inFn = getFirstBlockFileId(self.settings['input'])
131 self.inF = None
132 self.outFn = 0
133 self.outsz = 0
134 self.outF = None
135 self.outFname = None
136 self.blkCountIn = 0
137 self.blkCountOut = 0
138
139 self.lastDate = datetime.datetime(2000, 1, 1)
140 self.highTS = 1408893517 - 315360000
141 self.timestampSplit = False
142 self.fileOutput = True
143 self.setFileTime = False
144 self.maxOutSz = settings['max_out_sz']
145 if 'output' in settings:
146 self.fileOutput = False
147 if settings['file_timestamp'] != 0:
148 self.setFileTime = True
149 if settings['split_timestamp'] != 0:
150 self.timestampSplit = True
151 # Extents and cache for out-of-order blocks
152 self.blockExtents = {}
153 self.outOfOrderData = {}
154 self.outOfOrderSize = 0 # running total size for items in outOfOrderData
155
156 def writeBlock(self, inhdr, blk_hdr, rawblock):
157 blockSizeOnDisk = len(inhdr) + len(blk_hdr) + len(rawblock)

Callers

nothing calls this directly

Calls 1

getFirstBlockFileIdFunction · 0.85

Tested by

no test coverage detected