Documentation ¶
Index ¶
- func GetUnmappedFiles(hashes PathHashes, files FileMap) []string
- func ParallelWalkHasherProgressReporter(reporter ProgressReporter) func(*ParallelWalkHasher)
- func SerialWalkHasherProgressReporter(reporter ProgressReporter) func(*SerialWalkHasher)
- type FileMap
- type ParallelWalkHasher
- type PathHashes
- type Progress
- type ProgressReporter
- type SerialWalkHasher
- type WalkHasher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUnmappedFiles ¶
func GetUnmappedFiles(hashes PathHashes, files FileMap) []string
GetUnmappedFiles returns all files that are in hashes but not files.
func ParallelWalkHasherProgressReporter ¶
func ParallelWalkHasherProgressReporter(reporter ProgressReporter) func(*ParallelWalkHasher)
ParallelWalkHasherProgressReporter will provide a ProgressReporter for a ParallelWalkWasher. Intended to be passed to NewParallelWalkHasher as an option.
func SerialWalkHasherProgressReporter ¶
func SerialWalkHasherProgressReporter(reporter ProgressReporter) func(*SerialWalkHasher)
SerialWalkHasherProgressReporter will provide a ProgressReporter for a SerialWalkHasher. Intended to be passed to NewSerialWalkHasher as an option.
Types ¶
type FileMap ¶
FileMap represents a mapping between one file path and any related file paths.
func FindIdenticalFiles ¶
func FindIdenticalFiles(hashes PathHashes, other PathHashes) FileMap
FindIdenticalFiles generates a FileMap that describes the identical files in hashes, mapped to the identical files in other.
func MakeFlippedFileMap ¶
MakeFlippedFileMap takes an existing map and moves all of the files in the value portion to the keys portion, and vice-versa.
type ParallelWalkHasher ¶
type ParallelWalkHasher struct {
// contains filtered or unexported fields
}
ParallelWalkHasher will hash all files concurrently, up to the number of specified workers.
func NewParallelWalkHasher ¶
func NewParallelWalkHasher(numWorkers int, constructor func() hash.Hash, options ...func(*ParallelWalkHasher)) *ParallelWalkHasher
NewParallelWalkHasher makekes a new ParallelWalkHasher with a constructor for a hash algorithm and a number of workers.
func (*ParallelWalkHasher) WalkAndHash ¶
func (hasher *ParallelWalkHasher) WalkAndHash(root string) (PathHashes, error)
WalkAndHash walks the given path across all workers and returns hashes for all the files in the path.
type PathHashes ¶
PathHashes represent the hashes for all paths walked by a WalkHasher, with the path as the key, and the hash as the value.
type Progress ¶
type Progress int
Progress repressents the progress of something, on a scale of 0-100
type ProgressReporter ¶
type ProgressReporter interface { // ReportProgress will report the progress of the process. ReportProgress(progress Progress) }
ProgressReporter will report the progress of a process.
type SerialWalkHasher ¶
type SerialWalkHasher struct {
// contains filtered or unexported fields
}
SerialWalkHasher will hash all files one after the other. Implements HashWalker.
func NewSerialWalkHasher ¶
func NewSerialWalkHasher(constructor func() hash.Hash, options ...func(*SerialWalkHasher)) *SerialWalkHasher
NewSerialWalkHasher makes a new SerialWalkHasher with a constructor for a hash algorithm.
func (SerialWalkHasher) WalkAndHash ¶
func (hasher SerialWalkHasher) WalkAndHash(root string) (PathHashes, error)
WalkAndHash walks the given path and returns hashes for all the files in the path.
type WalkHasher ¶
type WalkHasher interface { // WalkAndHash takes a root path and returns a path of each file, along with its hash. WalkAndHash(root string) (PathHashes, error) }
WalkHasher represents something that can walk a tree and generate hashes.