bloomfilter

package
v1.69.0-cluster Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter limits the number of added items.

It is safe using the Limiter from concurrent goroutines.

func NewLimiter

func NewLimiter(maxItems int, refreshInterval time.Duration) *Limiter

NewLimiter creates new Limiter, which can hold up to maxItems unique items during the given refreshInterval.

func (*Limiter) Add

func (l *Limiter) Add(h uint64) bool

Add adds h to the limiter.

It is safe calling Add from concurrent goroutines.

True is returned if h is added or already exists in l. False is returned if h cannot be added to l, since it already has maxItems unique items.

func (*Limiter) CurrentItems

func (l *Limiter) CurrentItems() int

CurrentItems return the current number of items registered in l.

func (*Limiter) MaxItems

func (l *Limiter) MaxItems() int

MaxItems returns the maxItems passed to NewLimiter.

func (*Limiter) MustStop added in v1.65.0

func (l *Limiter) MustStop()

MustStop stops the given limiter. It is expected that nobody access the limiter at MustStop call.

Jump to

Keyboard shortcuts

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