dirchecksum

package
v2.20.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumSet

type ChecksumSet struct {
	RootDir   string
	Checksums map[string]FileChecksumInfo
}

func ChecksumsForDirAfterAction

func ChecksumsForDirAfterAction(dir string, action func(dir string) error) (ChecksumSet, error)

ChecksumsForDirAfterAction returns the Checksumset for the state of the target directory after running the provided action on it. The target directory is returned to its original state after the action is run. Uses the following process:

* Copies the target directory to a temporary location (unique location in the same parent directory) * Moves the target directory to another temporary location (unique location in the same parent directory) * Moves the copied directory to the original location * Runs the provided action * Computes the checksums for the directory * Removes the directory * Moves the original target directory from the temporary location back to its original location

The result of the above is that the checksums are computed for the directory after the action is run, but the target directory stays in its original state. This function registers a signal handler that restores the state to the original state on SIGINT or SIGTERM signals and then calls os.Exit(1).

func ChecksumsForMatchingPaths

func ChecksumsForMatchingPaths(rootDir string, m matcher.Matcher) (ChecksumSet, error)

func (*ChecksumSet) Diff

func (c *ChecksumSet) Diff(other ChecksumSet) ChecksumsDiff

func (*ChecksumSet) SortedKeys

func (c *ChecksumSet) SortedKeys() []string

type ChecksumsDiff

type ChecksumsDiff struct {
	RootDir string
	Diffs   map[string]string
}

func (*ChecksumsDiff) String

func (c *ChecksumsDiff) String() string

type FileChecksumInfo

type FileChecksumInfo struct {
	Path           string
	IsDir          bool
	SHA256checksum string
}

Jump to

Keyboard shortcuts

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