util

package
v0.0.0-...-0512d79 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicallyWriteFile

func AtomicallyWriteFile(filename string, data []byte, perm os.FileMode) error

func FileMetaEqual

func FileMetaEqual(actual data.FileMeta, expected data.FileMeta) error

func GenerateFileMeta

func GenerateFileMeta(r io.Reader, hashAlgorithms ...string) (data.FileMeta, error)

func GenerateSnapshotFileMeta

func GenerateSnapshotFileMeta(r io.Reader, hashAlgorithms ...string) (data.SnapshotFileMeta, error)

func GenerateTargetFileMeta

func GenerateTargetFileMeta(r io.Reader, hashAlgorithms ...string) (data.TargetFileMeta, error)

func GenerateTimestampFileMeta

func GenerateTimestampFileMeta(r io.Reader, hashAlgorithms ...string) (data.TimestampFileMeta, error)

func HashedPaths

func HashedPaths(p string, hashes data.Hashes) []string

func NormalizeTarget

func NormalizeTarget(p string) string

func SnapshotFileMetaEqual

func SnapshotFileMetaEqual(actual data.SnapshotFileMeta, expected data.SnapshotFileMeta) error

func StringSliceToSet

func StringSliceToSet(items []string) map[string]struct{}

func TargetFileMetaEqual

func TargetFileMetaEqual(actual data.TargetFileMeta, expected data.TargetFileMeta) error

func TimestampFileMetaEqual

func TimestampFileMetaEqual(actual data.TimestampFileMeta, expected data.TimestampFileMeta) error

func VersionedPath

func VersionedPath(p string, version int) string

Types

type ErrNoCommonHash

type ErrNoCommonHash struct {
	Expected data.Hashes
	Actual   data.Hashes
}

func (ErrNoCommonHash) Error

func (e ErrNoCommonHash) Error() string

type ErrUnknownHashAlgorithm

type ErrUnknownHashAlgorithm struct {
	Name string
}

func (ErrUnknownHashAlgorithm) Error

func (e ErrUnknownHashAlgorithm) Error() string

type ErrWrongHash

type ErrWrongHash struct {
	Type     string
	Expected data.HexBytes
	Actual   data.HexBytes
}

func (ErrWrongHash) Error

func (e ErrWrongHash) Error() string

type ErrWrongLength

type ErrWrongLength struct {
	Expected int64
	Actual   int64
}

func (ErrWrongLength) Error

func (e ErrWrongLength) Error() string

type ErrWrongVersion

type ErrWrongVersion struct {
	Expected int
	Actual   int
}

func (ErrWrongVersion) Error

func (e ErrWrongVersion) Error() string

type PassphraseFunc

type PassphraseFunc func(role string, confirm bool) ([]byte, error)

Jump to

Keyboard shortcuts

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