func encodeLogEntry(entry *LogEntry) []byte { // Marshal log entry. entryData, err := proto.Marshal(entry) if err != nil { panic(fmt.Sprintf("unable to marshal log entry: %s", err)) } // Encode the length of the data first, followed by the encoded data. data := encoding.EncodeUint32([]byte(nil), uint32(len(entryData))) return append(data, entryData...) }
func (v *Value) setChecksum(cksum uint32) { if len(v.RawBytes) >= checksumSize { encoding.EncodeUint32(v.RawBytes[:0], cksum) } }