Help us shape the future of Go! Take the 2026 Go Developer Survey

dedupe

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 3 Imported by: 0

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