MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / decode

Method decode

cassandra/segment.py:209–222  ·  view source on GitHub ↗
(self, buffer, header)

Source from the content-addressed store, hash-verified

207 return SegmentHeader(payload_length, uncompressed_payload_length, is_self_contained)
208
209 def decode(self, buffer, header):
210 encoded_payload = buffer.read(header.payload_length)
211 expected_payload_crc = read_uint_le(buffer)
212
213 actual_payload_crc = compute_crc32(encoded_payload, CRC32_INITIAL)
214 if actual_payload_crc != expected_payload_crc:
215 raise CrcException('CRC mismatch on payload. Received {:x}", computed {:x}.'.format(
216 expected_payload_crc, actual_payload_crc))
217
218 payload = encoded_payload
219 if self.compression and header.uncompressed_payload_length > 0:
220 payload = self.decompress(encoded_payload, header.uncompressed_payload_length)
221
222 return Segment(payload, header.is_self_contained)

Calls 6

decompressMethod · 0.95
read_uint_leFunction · 0.90
compute_crc32Function · 0.85
CrcExceptionClass · 0.85
SegmentClass · 0.85
readMethod · 0.80