Skip to content

Commit a847beb

Browse files
committed
Remove NewBloomFilter constructor and tests
Per review feedback, removing the NewBloomFilter constructor as it adds unnecessary API surface area. MapSpec fields are public and can be used directly to create bloom filter maps. The MapExtra field parsing from ELF is already implemented and working in the ELF loader, so bloom filters can be loaded from BPF programs. Fixes cilium#1856
1 parent f079fc5 commit a847beb

File tree

2 files changed

+0
-135
lines changed

2 files changed

+0
-135
lines changed

bloom_filter_test.go

Lines changed: 0 additions & 113 deletions
This file was deleted.

map.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,25 +1817,3 @@ func sliceLen(slice any) (int, error) {
18171817
return sliceValue.Len(), nil
18181818
}
18191819

1820-
// NewBloomFilter creates a new bloom filter map.
1821-
//
1822-
// valueSize is the size of the values to be hashed.
1823-
// maxEntries is used to approximate the size of the bloom filter bitmap.
1824-
// numHashes specifies the number of hash functions to use (1-15).
1825-
// If numHashes is 0, the default of 5 hash functions will be used.
1826-
//
1827-
// The bloom filter map type is available from Linux 5.16.
1828-
func NewBloomFilter(name string, valueSize, maxEntries uint32, numHashes uint8) (*MapSpec, error) {
1829-
if numHashes > 15 {
1830-
return nil, fmt.Errorf("number of hashes must be between 0 and 15, got %d", numHashes)
1831-
}
1832-
1833-
return &MapSpec{
1834-
Name: name,
1835-
Type: BloomFilter,
1836-
KeySize: 0, // Bloom filters don't have keys
1837-
ValueSize: valueSize,
1838-
MaxEntries: maxEntries,
1839-
MapExtra: uint64(numHashes),
1840-
}, nil
1841-
}

0 commit comments

Comments
 (0)