Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit eafcea3

Browse files
committed
v2: finalize v2
1 parent 96fdc25 commit eafcea3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

v2/bloomfilter/bloomfilter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func New(size int, numHashFuncs int) *BloomFilter {
5353

5454
// Create hash functions
5555
for i := 0; i < numHashFuncs; i++ {
56-
seed := uint32(i)
56+
seed := uint32(i) // Seed for the hash function
5757
hashFuncs[i] = func(data []byte) uint32 {
5858
return murmur.Hash32(data, seed) // Return the hash value
5959
}
@@ -168,7 +168,7 @@ func Deserialize(data []byte) (*BloomFilter, error) {
168168
if err := binary.Read(buf, binary.LittleEndian, &bitArraySize); err != nil {
169169
return nil, err
170170
}
171-
if bitArraySize < 0 || bitArraySize > 1<<20 { // Add reasonable limit
171+
if bitArraySize < 0 || bitArraySize > 1<<20 { // Check if the bit array size is valid
172172
return nil, errors.New("invalid bit array size")
173173
}
174174
bf.bitArray = make([]bool, bitArraySize)

v2/k4.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@ func (it *Iterator) Next() ([]byte, []byte) {
19861986
return key, value
19871987
}
19881988
} else {
1989-
it.sstIterIndex--
1989+
it.sstIterIndex-- // If we have no more keys in the sstable we move to the next sstable
19901990
}
19911991
}
19921992

@@ -2045,7 +2045,7 @@ func (it *Iterator) Prev() ([]byte, []byte) {
20452045
return key, value
20462046
}
20472047
} else {
2048-
it.sstIterIndex++
2048+
it.sstIterIndex++ // If we have no more keys in the sstable we move to the next sstable
20492049

20502050
}
20512051
}

0 commit comments

Comments
 (0)