mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? Add new Counter implementations: - count-min sketch for high cardinality of keys - hybrid to switch from map to sketch when number of keys gets high enough ## Why? Support high cardinality of fairness keys. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [x] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s)
10 lines
377 B
Go
10 lines
377 B
Go
package counter
|
|
|
|
type Counter interface {
|
|
// GetPass tracks a value per key, which may be lossy or approximate. It increments the
|
|
// value by inc and returns the new value. The value returned must be >= base.
|
|
GetPass(key string, base, inc int64) int64
|
|
// EstimateDistinctKeys returns an estimate of the number of distinct keys in the counter.
|
|
EstimateDistinctKeys() int
|
|
}
|