dedup

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath added in v1.9.0

func DefaultPath() string

DefaultPath returns the default path for the deduplication service's badger DB

Types

type Dedup added in v1.9.0

type Dedup interface {
	// Set returns [true] if it was the first time the key was encountered, otherwise it returns [false] along with the previous value
	Set(kv KeyValue) (bool, int64)

	// Commit commits a list of previously set keys to the DB
	Commit(keys []string) error

	// Close closes the deduplication service
	Close()
}

Dedup is the interface for deduplication service

func New

func New(path string, fns ...OptFn) Dedup

New creates a new deduplication service. The service needs to be closed after use.

type KeyValue added in v1.9.0

type KeyValue struct {
	Key   string
	Value int64
}

type OptFn

type OptFn func(*badgerDB)

func WithClearDB

func WithClearDB() OptFn

WithClearDB clears the DB on startup

func WithWindow

func WithWindow(d time.Duration) OptFn

WithWindow sets the window for deduplication

Jump to

Keyboard shortcuts

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