fix: prevent users from settings a growthfactor=1
- This always causes errors, it should not be possible.
This commit is contained in:
@@ -49,10 +49,10 @@ func MinimumLoad(value float64) Option {
|
||||
}
|
||||
|
||||
// GrowthFactor controls how much the capacity of the [Table] multiplies when
|
||||
// it must resize. The value must be greater than 0.
|
||||
// it must resize. The value must be greater than 1.
|
||||
func GrowthFactor(value int) Option {
|
||||
if value <= 0 {
|
||||
panic(fmt.Sprintf("go-cuckoo: GrowthFactor must be greater than 0, got %d", value))
|
||||
if value < 2 {
|
||||
panic(fmt.Sprintf("go-cuckoo: GrowthFactor must be greater than 1, got %d", value))
|
||||
}
|
||||
|
||||
return func(s *settings) { s.growthFactor = uint64(value) }
|
||||
|
||||
Reference in New Issue
Block a user