util

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToPtr added in v0.20.0

func BoolToPtr(b bool) *bool

func Bunzip2 added in v0.2.1

func Bunzip2(dst io.Writer, src io.Reader) (written int64, err error)

Bunzip2 does bunzip2 decompression from src to dst.

It matches the signature of io.Copy.

func Bunzip2File added in v0.2.1

func Bunzip2File(dst, src string) error

Bunzip2File does bunzip2 decompression from src file into dst file.

func Bunzip2FileGo added in v0.20.0

func Bunzip2FileGo(dst, src string) error

func CopyProgress

func CopyProgress(level capnslog.LogLevel, prefix string, writer io.Writer, reader io.Reader, total int64) (int64, error)

CopyProgress copies data from reader into writter, logging progress through level.

func LogFrom

func LogFrom(l capnslog.LogLevel, r io.Reader)

LogFrom reads lines from reader r and sends them to logger l.

func Retry

func Retry(attempts int, delay time.Duration, f func() error) error

Retry calls function f until it has been called attemps times, or succeeds. Retry delays for delay between calls of f. If f does not succeed after attempts calls, the error from the last call is returned.

func RetryConditional added in v0.8.0

func RetryConditional(attempts int, delay time.Duration, shouldRetry func(err error) bool, f func() error) error

RetryConditional calls function f until it has been called attemps times, or succeeds. Retry delays for delay between calls of f. If f does not succeed after attempts calls, the error from the last call is returned. If shouldRetry returns false on the error generated, RetryConditional stops immediately and returns the error

func StrToPtr added in v0.20.0

func StrToPtr(s string) *string

func WaitUntilReady added in v0.8.0

func WaitUntilReady(timeout, delay time.Duration, checkFunction func() (bool, error)) error

func XZ2File added in v0.20.0

func XZ2File(dst, src string) error

XZ2File does xz decompression from src file into dst file

Types

type ImageInfo added in v0.12.0

type ImageInfo struct {
	Format      string `json:"format"`
	VirtualSize uint64 `json:"virtual-size"`
}

func GetImageInfo added in v0.12.0

func GetImageInfo(path string) (*ImageInfo, error)

Jump to

Keyboard shortcuts

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