heavykeeper

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeavyKeeper

type HeavyKeeper struct {
	// contains filtered or unexported fields
}

HeavyKeeper is a probabilistic data structure for top-k items.

func New

func New(depth, width int, decay float64) *HeavyKeeper

New creates a new HeavyKeeper. depth: number of arrays (hash functions) width: number of buckets per array decay: probability of decay (0.9 means 90% chance to decay)

func (*HeavyKeeper) Add

func (hk *HeavyKeeper) Add(key []byte)

Add adds a key to the HeavyKeeper.

func (*HeavyKeeper) Clear

func (hk *HeavyKeeper) Clear()

Clear resets the HeavyKeeper.

func (*HeavyKeeper) Query

func (hk *HeavyKeeper) Query(key []byte) uint32

Query returns the estimated count for the key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL