use named constants for bloom filter parameters

This commit is contained in:
vyzo 2021-02-28 10:57:38 +02:00
parent 44aadb931a
commit f62999d2b8

View File

@ -10,6 +10,11 @@ import (
blake2b "github.com/minio/blake2b-simd"
)
const (
BloomFilterSize = 50_000_000
BloomFilterProbability = 0.01
)
type BloomLiveSetEnv struct{}
var _ LiveSetEnv = (*BloomLiveSetEnv)(nil)
@ -32,7 +37,7 @@ func (e *BloomLiveSetEnv) NewLiveSet(name string) (LiveSet, error) {
return nil, xerrors.Errorf("error reading salt: %w", err)
}
bf, err := bbloom.New(float64(50_000_000), float64(0.01))
bf, err := bbloom.New(float64(BloomFilterSize), float64(BloomFilterProbability))
if err != nil {
return nil, xerrors.Errorf("error creating bloom filter: %w", err)
}