distribution: github.com/docker/distribution/digestset Index | Files

package digestset

import "github.com/docker/distribution/digestset"

Index

Package Files

set.go

Variables

var (
    // ErrDigestNotFound is used when a matching digest
    // could not be found in a set.
    ErrDigestNotFound = errors.New("digest not found")

    // ErrDigestAmbiguous is used when multiple digests
    // are found in a set. None of the matching digests
    // should be considered valid matches.
    ErrDigestAmbiguous = errors.New("ambiguous digest string")
)

func ShortCodeTable Uses

func ShortCodeTable(dst *Set, length int) map[digest.Digest]string

ShortCodeTable returns a map of Digest to unique short codes. The length represents the minimum value, the maximum length may be the entire value of digest if uniqueness cannot be achieved without the full value. This function will attempt to make short codes as short as possible to be unique.

type Set Uses

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

Set is used to hold a unique set of digests which may be easily referenced by easily referenced by a string representation of the digest as well as short representation. The uniqueness of the short representation is based on other digests in the set. If digests are omitted from this set, collisions in a larger set may not be detected, therefore it is important to always do short representation lookups on the complete set of digests. To mitigate collisions, an appropriately long short code should be used.

func NewSet Uses

func NewSet() *Set

NewSet creates an empty set of digests which may have digests added.

func (*Set) Add Uses

func (dst *Set) Add(d digest.Digest) error

Add adds the given digest to the set. An error will be returned if the given digest is invalid. If the digest already exists in the set, this operation will be a no-op.

func (*Set) All Uses

func (dst *Set) All() []digest.Digest

All returns all the digests in the set

func (*Set) Lookup Uses

func (dst *Set) Lookup(d string) (digest.Digest, error)

Lookup looks for a digest matching the given string representation. If no digests could be found ErrDigestNotFound will be returned with an empty digest value. If multiple matches are found ErrDigestAmbiguous will be returned with an empty digest value.

func (*Set) Remove Uses

func (dst *Set) Remove(d digest.Digest) error

Remove removes the given digest from the set. An err will be returned if the given digest is invalid. If the digest does not exist in the set, this operation will be a no-op.

Package digestset imports 5 packages (graph) and is imported by 140 packages. Updated 2018-08-08. Refresh now. Tools for package owners.