freakyzoidberg commented on code in PR #75:
URL: https://github.com/apache/datasketches-go/pull/75#discussion_r2639904897


##########
filters/bloom_filter.go:
##########
@@ -0,0 +1,600 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Package filters provides probabilistic membership data structures for 
efficient
+// set membership testing with controlled false positive rates.
+//
+// The Bloom filter is a space-efficient probabilistic data structure that is 
used
+// to test whether an element is a member of a set. False positive matches are
+// possible, but false negatives are not. This implementation uses XXHash64 
with
+// Kirsch-Mitzenmacher double hashing optimization.
+package filters
+
+import (
+       "encoding/binary"
+       "fmt"
+       "math"
+       "math/bits"
+
+       "github.com/cespare/xxhash/v2"
+)
+
+// BloomFilter is a probabilistic data structure for set membership testing.
+// It provides constant-time updates and queries with a configurable false
+// positive rate. No false negatives are possible.
+type BloomFilter interface {
+       // Update methods add items to the filter
+       UpdateUInt64(datum uint64) error
+       UpdateInt64(datum int64) error
+       UpdateString(datum string) error
+       UpdateSlice(datum []byte) error
+       UpdateFloat64(datum float64) error
+       UpdateInt64Array(data []int64) error
+       UpdateFloat64Array(data []float64) error
+
+       // Query methods test membership
+       QueryUInt64(datum uint64) bool
+       QueryInt64(datum int64) bool
+       QueryString(datum string) bool
+       QuerySlice(datum []byte) bool
+       QueryFloat64(datum float64) bool
+       QueryInt64Array(data []int64) bool
+       QueryFloat64Array(data []float64) bool
+
+       // QueryAndUpdate atomically queries and updates (test-and-set)

Review Comment:
   Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to