dedupe

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 3 modules, 3 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

View Source
var MaxInMemoryDedupeSize = 100 * 1024 * 1024

MaxInMemoryDedupeSize (default : 100 MB)

Functions

This section is empty.

Types

type Dedupe

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

Dedupe is string deduplication type which removes all duplicates if

func NewDedupe

func NewDedupe(ch <-chan string, byteLen int) *Dedupe

NewDedupe returns a dedupe instance which removes all duplicates Note: If byteLen is not correct/specified alterx may consume lot of memory

func (*Dedupe) Drain

func (d *Dedupe) Drain(opts ...Option)

Drains channel and tries to dedupe it

func (*Dedupe) GetResults

func (d *Dedupe) GetResults() <-chan string

GetResults iterates over dedupe storage and returns results

type DedupeBackend

type DedupeBackend interface {
	// Upsert add/update key to backend/database
	Upsert(elem string) bool
	// Execute given callback on each element while iterating
	IterCallback(callback func(elem string))
	// Cleanup cleans any residuals after deduping
	Cleanup()
}

type LevelDBBackend

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

func NewLevelDBBackend

func NewLevelDBBackend() *LevelDBBackend

func (*LevelDBBackend) Cleanup

func (l *LevelDBBackend) Cleanup()

func (*LevelDBBackend) IterCallback

func (l *LevelDBBackend) IterCallback(callback func(elem string))

func (*LevelDBBackend) Upsert

func (l *LevelDBBackend) Upsert(elem string) bool

type MapBackend

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

func NewMapBackend

func NewMapBackend() *MapBackend

func (*MapBackend) Cleanup

func (m *MapBackend) Cleanup()

func (*MapBackend) IterCallback

func (m *MapBackend) IterCallback(callback func(elem string))

func (*MapBackend) Upsert

func (m *MapBackend) Upsert(elem string) bool

type Option

type Option func(val string)

Option is a type for variadic options in Drain

func WithUnique

func WithUnique(ch chan<- string) Option

WithUnique is an option to send unique values to the provided channel

Jump to

Keyboard shortcuts

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