collisiondetector

package
v0.0.0-...-444f1c3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollisionDetector

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

CollisionDetector takes a stream of FilePrints and detects collisions, i. e., files with the same contetns but different names.

After creation with NewCollisionDetector, Start should be called to use it. See Start documentation for important details.

func NewCollisionDetector

func NewCollisionDetector(concurrentFiles int) *CollisionDetector

NewCollisionDetector creates a new CollisionDetector.

func (*CollisionDetector) ReportCollisions

func (cd *CollisionDetector) ReportCollisions() map[string][]string

ReportCollisions creates a "report" mapping each hash with all the files (by path) detected to be doppelgangers.

func (*CollisionDetector) ReportUniques

func (cd *CollisionDetector) ReportUniques() []string

ReportUniques creates a slice of paths deemed to be unique (i. e., without doppelgangers).

func (*CollisionDetector) Start

func (cd *CollisionDetector) Start() (chan<- *fileprint.FilePrint, <-chan error)

Start initializes the CollisionDetector and makes it ready for use.

It returns two channels. The first one is for FilePrints to be sent to. The seconds communicates errors at any step of the process, if any.

To shutdown the CollisionDetector, close the first channel and "drain" the errors channel (receive any pending errors and wait for it to close).

Jump to

Keyboard shortcuts

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