1
0
mirror of https://github.com/taigrr/bitcask synced 2025-01-18 04:03:17 -08:00

custom high-performance encoder implementation (#52)

This commit is contained in:
Ignacio Hagopian
2019-08-07 20:21:46 -03:00
committed by James Mills
parent 755b1879b5
commit fd179b4a86
13 changed files with 173 additions and 225 deletions

23
internal/model/entry.go Normal file
View File

@@ -0,0 +1,23 @@
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,
}
}