util

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: BSD-3-Clause Imports: 15 Imported by: 13

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 BytesMatchLenAndHashes added in v0.3.1

func BytesMatchLenAndHashes(fetched []byte, length int64, hashes data.Hashes) 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 TargetFileMetaEqual

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

func TimestampFileMetaEqual

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

func VersionEqual added in v0.3.1

func VersionEqual(actual int64, expected int64) error

func VersionedPath

func VersionedPath(p string, version int64) 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 int64
	Actual   int64
}

func (ErrWrongVersion) Error

func (e ErrWrongVersion) Error() string

type PassphraseFunc

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

Jump to

Keyboard shortcuts

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