Package tarsum provides algorithms to perform checksum calculation on filesystem layers.
The transportation of filesystems, regarding Docker, is done with tar(1) archives. There are a variety of tar serialization formats , and a key concern here is ensuring a repeatable checksum given a set of inputs from a generic tar archive. Types of transportation include distribution to and from a registry endpoint, saving and loading through commands or Docker daemon APIs, transferring the build context from client to Docker daemon, and committing the filesystem of a container to become an image.
As tar archives are used for transit, but not preserved in many situations, the focus of the algorithm is to ensure the integrity of the preserved filesystem, while maintaining a deterministic accountability. This includes neither constraining the ordering or manipulation of the files during the creation or unpacking of the archive, nor include additional metadata state about the file system attributes.
- func VersionLabelForChecksum(checksum string) string
- type BuilderContext
- type FileInfoSumInterface
- type FileInfoSums
- func (fis FileInfoSums) GetAllFile(name string) FileInfoSums
- func (fis FileInfoSums) GetDuplicatePaths() (dups FileInfoSums)
- func (fis FileInfoSums) GetFile(name string) FileInfoSumInterface
- func (fis FileInfoSums) Len() int
- func (fis FileInfoSums) SortByNames()
- func (fis FileInfoSums) SortByPos()
- func (fis FileInfoSums) SortBySums()
- func (fis FileInfoSums) Swap(i, j int)
- type THash
- type TarSum
- type Version
This section is empty.
Errors that may be returned by functions in this package
TarSum default is "sha256"
type BuilderContext ¶
BuilderContext is an interface extending TarSum by adding the Remove method. In general there was concern about adding this method to TarSum itself so instead it is being added just to "BuilderContext" which will then only be used during the .dockerignore file processing - see builder/evaluator.go
type FileInfoSumInterface ¶
FileInfoSumInterface provides an interface for accessing file checksum information within a tar file. This info is accessed through interface so the actual name and sum cannot be medled with.
type FileInfoSums ¶
type FileInfoSums FileInfoSumInterface
FileInfoSums provides a list of FileInfoSumInterfaces.
func (FileInfoSums) GetAllFile ¶
GetAllFile returns a FileInfoSums with all matching names.
func (FileInfoSums) GetDuplicatePaths ¶
GetDuplicatePaths returns a FileInfoSums with all duplicated paths.
GetFile returns the first FileInfoSumInterface with a matching name.
Len returns the size of the FileInfoSums.
func (FileInfoSums) SortByNames ¶
func (fis FileInfoSums) SortByNames()
SortByNames sorts FileInfoSums content by name.
func (fis FileInfoSums) SortByPos()
SortByPos sorts FileInfoSums content by position.
func (FileInfoSums) SortBySums ¶
func (fis FileInfoSums) SortBySums()
SortBySums sorts FileInfoSums content by sums.
THash provides a hash.Hash type generator and its name.
TarSum is the generic interface for calculating fixed time checksums of a tar archive.
NewTarSum creates a new interface for calculating a fixed time checksum of a tar archive.
This is used for calculating checksums of layers of an image, in some cases including the byte payload of the image's json metadata as well, and for calculating the checksums for buildcache.
func NewTarSumForLabel ¶
NewTarSumForLabel creates a new TarSum using the provided TarSum version+hash label.
type Version int
Version is used for versioning of the TarSum algorithm based on the prefix of the hash used i.e. "tarsum+sha256:e58fcf7418d4390dec8e8fb69d88c06ec07039d651fedd3aa72af9972e7d046b"
Prefix of "tarsum"
func GetVersionFromTarsum ¶
GetVersionFromTarsum returns the Version from the provided string.
func GetVersions ¶
func GetVersions() Version
GetVersions gets a list of all known tarsum versions.