Add support for unlimited key/value sizes

This commit is contained in:
2020-12-12 02:16:36 +10:00
parent 38156e8461
commit 0ab7d79246
2 changed files with 3 additions and 3 deletions

View File

@@ -179,10 +179,10 @@ func (b *Bitcask) Put(key, value []byte) error {
if len(key) == 0 {
return ErrEmptyKey
}
if uint32(len(key)) > b.config.MaxKeySize {
if b.config.MaxKeySize > 0 && uint32(len(key)) > b.config.MaxKeySize {
return ErrKeyTooLarge
}
if uint64(len(value)) > b.config.MaxValueSize {
if b.config.MaxValueSize > 0 && uint64(len(value)) > b.config.MaxValueSize {
return ErrValueTooLarge
}