heavykeeper

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 5 Imported by: 0

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