directory_checksum

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

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

A Directory represents a physical directory on the file system. files and dirs contain only the immediate child objects. The files and dirs fields map from the file's / dir's name to its corresponding File/Directory object.

func ScanDirectory

func ScanDirectory(absoluteRootPath string, filesystemImpl afero.Fs) (*Directory, error)

ScanDirectory returns the pointer to a (hierarchically-nested) Directory that is constructed from recursively walking the directory located at absoluteRootPath.

func (*Directory) Add

func (d *Directory) Add(relativeRemainingPath string, relativePath string, absoluteRootPath string, fileType FileType,
	filesystemImpl afero.Fs) error

Add adds the file or directory located at absoluteRootPath/relativePath to the correct Directory object. relativeRemainingPath is a helper argument, used to traverse down the Directory object hierarchy, and must initially be set to the same value as relativePath. If fileType is not(!) TypeDir, the SHA-1 checksum is computed

func (*Directory) ComputeDirectoryChecksums

func (d *Directory) ComputeDirectoryChecksums() (string, error)

ComputeDirectoryChecksums recursively computes the "checksum" field of all Directory objects, and returns the checksum of the object this method is called on. It assumes that the checksum of all files(!) have already been computed.

func (*Directory) PrintChecksums

func (d *Directory) PrintChecksums(depth int) string

type File

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

type FileType

type FileType int64
const (
	TypeFile    FileType = 0
	TypeDir     FileType = 1
	TypeSymlink FileType = 2
)

Jump to

Keyboard shortcuts

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