Documentation ¶
Overview ¶
Package hash implements a concurrent file hasher used by spok to detect when task dependencies have changed.
The hasher opens, reads, hashes contents and filepath, and closes each file with a sha256 digest, these are then collected in an order independent way and summed into an overall sha256 hash sum representing the state of all the hashed files.
The fully qualified filepath is included in each files hash so if any part of this changes this will count as a change as well as any change to file contents.
Index ¶
Constants ¶
const ALWAYS = "ALWAYS"
ALWAYS is a constant string that is different to the string returned from the AlwaysRun hasher to be used as the cache comparison value so that a task is always re-run regardless of it's dependencies.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlwaysRun ¶
type AlwaysRun struct{}
AlwaysRun is a Hasher that always returns a constant value for the final digest: "DIFFERENT", it is used primarily when forcing tasks to re-run regardless of the state of their dependencies e.g. (spok <tasks...> --force).
func (AlwaysRun) Hash ¶
Hash implements Hasher for AlwaysRun and returns the constant string "DIFFERENT" in place of an actual hash digest. Comparing the return of this method to the "ALWAYS" constant will result in the digests never matching and therefore tasks that use this will always run regardless of the state of their dependencies.