mirror of
https://github.com/taigrr/bitcask
synced 2025-01-18 04:03:17 -08:00
24 lines
344 B
Go
24 lines
344 B
Go
package model
|
|
|
|
import (
|
|
"hash/crc32"
|
|
)
|
|
// Entry represents a key/value in the database
|
|
type Entry struct {
|
|
Checksum uint32
|
|
Key []byte
|
|
Offset int64
|
|
Value []byte
|
|
}
|
|
|
|
|
|
func NewEntry(key, value []byte) Entry {
|
|
checksum := crc32.ChecksumIEEE(value)
|
|
|
|
return Entry{
|
|
Checksum: checksum,
|
|
Key: key,
|
|
Value: value,
|
|
}
|
|
}
|