getLogRecordCRC calculates the CRC checksum for a LogRecord.
(logRecord *LogRecord, header []byte)
| 125 | |
| 126 | // getLogRecordCRC calculates the CRC checksum for a LogRecord. |
| 127 | func 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 | } |