MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / getLogRecordCRC

Function getLogRecordCRC

engine/data/log_record.go:127–139  ·  view source on GitHub ↗

getLogRecordCRC calculates the CRC checksum for a LogRecord.

(logRecord *LogRecord, header []byte)

Source from the content-addressed store, hash-verified

125
126// getLogRecordCRC calculates the CRC checksum for a LogRecord.
127func getLogRecordCRC(logRecord *LogRecord, header []byte) uint32 {
128 if logRecord == nil {
129 return 0
130 }
131 // Calculate CRC checksum for the header
132 crc := crc32.ChecksumIEEE(header[:])
133 // Update CRC checksum with the key
134 crc = crc32.Update(crc, crc32.IEEETable, logRecord.Key)
135 // Update CRC checksum with the value
136 crc = crc32.Update(crc, crc32.IEEETable, logRecord.Value)
137
138 return crc
139}

Callers 2

ReadLogRecordMethod · 0.85
TestGetLogRecordCRCFunction · 0.85

Calls 1

UpdateMethod · 0.80

Tested by 1

TestGetLogRecordCRCFunction · 0.68