Skip to content

Commit

Permalink
v2: finalize v2
Browse files Browse the repository at this point in the history
  • Loading branch information
guycipher committed Nov 9, 2024
1 parent 96fdc25 commit eafcea3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions v2/bloomfilter/bloomfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func New(size int, numHashFuncs int) *BloomFilter {

// Create hash functions
for i := 0; i < numHashFuncs; i++ {
seed := uint32(i)
seed := uint32(i) // Seed for the hash function
hashFuncs[i] = func(data []byte) uint32 {
return murmur.Hash32(data, seed) // Return the hash value
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func Deserialize(data []byte) (*BloomFilter, error) {
if err := binary.Read(buf, binary.LittleEndian, &bitArraySize); err != nil {
return nil, err
}
if bitArraySize < 0 || bitArraySize > 1<<20 { // Add reasonable limit
if bitArraySize < 0 || bitArraySize > 1<<20 { // Check if the bit array size is valid
return nil, errors.New("invalid bit array size")
}
bf.bitArray = make([]bool, bitArraySize)
Expand Down
4 changes: 2 additions & 2 deletions v2/k4.go
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,7 @@ func (it *Iterator) Next() ([]byte, []byte) {
return key, value
}
} else {
it.sstIterIndex--
it.sstIterIndex-- // If we have no more keys in the sstable we move to the next sstable
}
}

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

}
}
Expand Down

0 comments on commit eafcea3

Please sign in to comment.