hash

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache stores a map of image hashes from corona10/goimagehash

func NewCache

func NewCache(file, promNamespace string) (*Cache, error)

NewCache reads the given file to rebuild its map from the last time it was run. If the file does not exist, it will be created.

func (*Cache) GetHash

func (h *Cache) GetHash(file string) (*Image, error)

GetHash gets the hash from cache or if it does not exist it calcs it

func (*Cache) NumImages

func (h *Cache) NumImages() int

NumImages returns the number of images in the cache

func (*Cache) Persist

func (h *Cache) Persist(file string) error

Persist writes the cache to disk https://pkg.go.dev/github.com/corona10/goimagehash#ImageHash.Dump

type Differ

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

func NewDiffer

func NewDiffer(ctx context.Context, numWorkers, distanceThreshold int, workChan chan types.Pair, cache *Cache, deleteLogger *logrus.Logger, promNamespace string) *Differ

func (*Differ) Wait

func (dp *Differ) Wait() chan error

type Image

type Image struct {
	*goimagehash.ImageHash
	image.Config `json:"-"`
}

Image is the minimal data needed to compare images and is held in-memory by HashCache.Cache

Jump to

Keyboard shortcuts

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