filters

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	// Close closes the filter and releases associated resources
	Close()
	// UniqueURL specifies whether a URL is unique
	UniqueURL(url string) bool
	// UniqueContent specifies whether a content is unique
	// Deduplication is done by hashing of the response data.
	//
	// TODO: Consider levenshtein length / keyword based hashing
	// to account for dynamic response content.
	UniqueContent(content []byte) bool
}

Filter is an interface implemented by deduplication mechanism

type Simple

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

Simple is a simple unique URL filter.

The URLs are maintained in a global sync.Map for deduplication and no normalization is performed.

func NewSimple

func NewSimple() (*Simple, error)

NewSimple returns a new simple filter

func (*Simple) Close

func (s *Simple) Close()

Close closes the filter and relases associated resources

func (*Simple) UniqueContent

func (s *Simple) UniqueContent(data []byte) bool

UniqueContent returns true if the content is unique

func (*Simple) UniqueURL

func (s *Simple) UniqueURL(url string) bool

UniqueURL returns true if the URL is unique

Jump to

Keyboard shortcuts

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