Documentation
¶
Index ¶
- Variables
- func NewCMSketchCounter(params CMSketchParams, src rand.Source, topKProvider topKFunc) *cmSketch
- func NewHybridCounter(params CounterParams, src rand.Source) *hybridCounter
- func NewMapCounter(limit int) *mapCounter
- type CMSGrowParams
- type CMSketchParams
- type Counter
- type CounterParams
- type TopKEntry
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCounterParams = CounterParams{ MapLimit: 100, CMS: CMSketchParams{ W: 100, D: 5, Grow: CMSGrowParams{ SkipRateDecay: 10_000, Threshold: 0.35, Ratio: 1.5, MaxW: 10_000, }, }, }
Functions ¶
func NewCMSketchCounter ¶
func NewCMSketchCounter(params CMSketchParams, src rand.Source, topKProvider topKFunc) *cmSketch
func NewHybridCounter ¶
func NewHybridCounter(params CounterParams, src rand.Source) *hybridCounter
func NewMapCounter ¶
func NewMapCounter(limit int) *mapCounter
NewMapCounter creates a mapCounter that also tracks the top K entries.
Types ¶
type CMSGrowParams ¶
type CMSketchParams ¶
type CMSketchParams struct {
W int // width of sketch
D int // depth of sketch
Grow CMSGrowParams
}
type 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
// Get the counts for a small number of top keys (the maximum keys returned will be limited
// by the Counter's configuration). Not guaranteed to return the exact top.
TopK() []TopKEntry
}
type CounterParams ¶
type CounterParams struct {
MapLimit int
CMS CMSketchParams
}
Click to show internal directories.
Click to hide internal directories.