Documentation ¶
Index ¶
Constants ¶
const HASHSIZE = 64
HASHSIZE defines the maximum digest size in bytes some implemented hash algorithm uses
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { HashSpec HashingSpec HashAlgorithm string TraversalStrategy string }
Config stores any configuration necessary to run the application
type EqChannel ¶
type EqChannel chan<- []*Entry
EqChannel defines a channel receiving an array of Entry instance representing equivalent file system entries
type FindDuplicates ¶
FindDuplicates implements the main functionality to detect duplicate file system nodes in Sources using the given Config and prints the result as array of string to the out channel.
This is the only public API function
type HashingAlgorithm ¶
type HashingAlgorithm interface { // HashFile content or any data of a file according to some hashFileSpec. // The file is specified with a relative path and the hash stored in digest. HashFile(spec HashingSpec, relPath string, digest []byte) error // HashString hashes a given string and stores the result in digest HashString(hashme string, digest []byte) error // HashTwoHashes hashes two given hashes HashTwoHashes(input1 []byte, input2 []byte, digest []byte) error // HashDirectory updates the parent hash value with the child hash value HashDirectory(parent []byte, child []byte) error // String returns the hash algorithm's name in human-readable form String() string }
HashingAlgorithm is the generic interface for all hash algorithm implementations to be used
type HashingSpec ¶
type HashingSpec struct { FileContent bool FilePerm bool FileAbsPath bool FileRelPath bool FileBasename bool FileOwner bool FileGroup bool FileExt bool FileSize bool FileMtime bool FileAtime bool FolderBasename bool }
HashingSpec specifies which attributes shall be considered in a hash
func (*HashingSpec) Any ¶
func (h *HashingSpec) Any() bool
Any checks whether any boolean flag of HashingSpec is set
type Traversing ¶
Traversing is a function traversing a hierarchy of file system entries