checksum

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChecksumExtracted = errors.New("no checksum is extracted")
	ErrNoChecksumIsFound   = errors.New("no checksum is found")
)

Functions

func CalculateReader

func CalculateReader(file io.Reader, algorithm string) (string, error)

func CheckRegistry

func CheckRegistry(regist *aqua.Registry, checksums *Checksums, content []byte) error

func GetChecksumConfigFromFilename

func GetChecksumConfigFromFilename(filename, version string) *registry.Checksum

func GetChecksumFilePathFromConfigFilePath

func GetChecksumFilePathFromConfigFilePath(fs afero.Fs, cfgFilePath string) (string, error)

func GetRuntimesFromSupportedEnvs

func GetRuntimesFromSupportedEnvs(cfgSupportedEnvs, pkgSupportedEnvs []string) ([]*runtime.Runtime, error)

func RegistryID

func RegistryID(regist *aqua.Registry) string

Types

type Calculator

type Calculator struct{}

func NewCalculator

func NewCalculator() *Calculator

func (*Calculator) Calculate

func (calc *Calculator) Calculate(fs afero.Fs, filename, algorithm string) (string, error)

type Checksum

type Checksum struct {
	ID        string `json:"id"`
	Checksum  string `json:"checksum"`
	Algorithm string `json:"algorithm"`
}

type Checksums

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

func New

func New() *Checksums

func (*Checksums) Get

func (chksums *Checksums) Get(key string) *Checksum

func (*Checksums) Prune

func (chksums *Checksums) Prune()

func (*Checksums) ReadFile

func (chksums *Checksums) ReadFile(fs afero.Fs, p string) error

func (*Checksums) Set

func (chksums *Checksums) Set(key string, chk *Checksum)

func (*Checksums) UpdateFile

func (chksums *Checksums) UpdateFile(fs afero.Fs, p string) error

type FileParser

type FileParser struct{}

func (*FileParser) GetChecksum

func (parser *FileParser) GetChecksum(logE *logrus.Entry, assetName, checksumFileContent string, checksumConfig *registry.Checksum) (string, error)

func (*FileParser) ParseChecksumFile

func (parser *FileParser) ParseChecksumFile(content string, checksumConfig *registry.Checksum) (map[string]string, string, error)

Jump to

Keyboard shortcuts

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