util

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefaultUploadTagRef

func BuildDefaultUploadTagRef(item WithDigest, importRepo regname.Repository) (regname.Tag, error)

BuildDefaultUploadTagRef Builds a tag from the digest Algorithm and Digest

func Retry

func Retry(doFunc func() error) error

Types

type DefaultTagGenerator added in v0.28.0

type DefaultTagGenerator struct{}

DefaultTagGenerator implements GenerateTag and generates default tag

func (DefaultTagGenerator) GenerateTag added in v0.28.0

func (tagGen DefaultTagGenerator) GenerateTag(item imagedigest.DigestWrap, importRepo regname.Repository) (regname.Tag, error)

GenerateTag generates default tag

type LogLevel

type LogLevel int

LogLevel specifies logging level (i.e. DEBUG, WARN)

const (
	// LogTrace most verbose level
	LogTrace LogLevel = iota
	// LogDebug used when more information than normal is needed
	LogDebug LogLevel = iota
	// LogWarn only logs warnings and errors
	LogWarn LogLevel = iota
)

type NonRetryableError

type NonRetryableError struct {
	Message string
}

func (NonRetryableError) Error

func (n NonRetryableError) Error() string

type ProgressBarLogger

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

func (*ProgressBarLogger) End

func (l *ProgressBarLogger) End()

func (*ProgressBarLogger) Start

func (l *ProgressBarLogger) Start(progressChan <-chan regv1.Update)

type ProgressBarNoTTYLogger

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

func (*ProgressBarNoTTYLogger) End

func (l *ProgressBarNoTTYLogger) End()

func (*ProgressBarNoTTYLogger) Start

func (l *ProgressBarNoTTYLogger) Start(progressChan <-chan regv1.Update)

type ProgressLogger

type ProgressLogger interface {
	Start(progress <-chan regv1.Update)
	End()
}

func NewProgressBar

func NewProgressBar(ui goui.UI, finalMessage, errorMessagePrefix string) ProgressLogger

NewProgressBar constructor to build a ProgressLogger responsible for printing out a progress bar using updates when writing to a registry via ggcr

type RepoBasedTagGenerator added in v0.28.0

type RepoBasedTagGenerator struct{}

RepoBasedTagGenerator implements GenerateTag and generates repo-based tag

func (RepoBasedTagGenerator) GenerateTag added in v0.28.0

func (tagGen RepoBasedTagGenerator) GenerateTag(item imagedigest.DigestWrap, importRepo regname.Repository) (regname.Tag, error)

GenerateTag generates repo-based tags

type TagGenDigest added in v0.28.0

type TagGenDigest struct {
	Algorithm string
	Hex       string
}

TagGenDigest contains Algorithm and Hex values of image digest

func (TagGenDigest) Digest added in v0.28.0

func (t TagGenDigest) Digest() (regv1.Hash, error)

Digest returns regv1.Hash instance

type TagGenerator added in v0.28.0

type TagGenerator interface {
	GenerateTag(item imagedigest.DigestWrap, destinationRepo regname.Repository) (regname.Tag, error)
}

TagGenerator interface

type Throttle

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

func NewThrottle

func NewThrottle(max int) Throttle

func (Throttle) Done

func (t Throttle) Done()

func (Throttle) Take

func (t Throttle) Take()

type UILevelWriter

type UILevelWriter struct {
	goui.UI
	LogLevel LogLevel
}

UILevelWriter allows specifying a log level to a ui.UI

func NewUILevelLogger

func NewUILevelLogger(level LogLevel, ui goui.UI) *UILevelWriter

NewUILevelLogger is a UILevelWriter constructor, wrapping a ui.UI with a specific log level

func (UILevelWriter) Debugf

func (l UILevelWriter) Debugf(msg string, args ...interface{})

Debugf used to log debug related messages

func (UILevelWriter) Errorf

func (l UILevelWriter) Errorf(msg string, args ...interface{})

Errorf used to log error related messages

func (UILevelWriter) Logf

func (l UILevelWriter) Logf(msg string, args ...interface{})

Logf logs the provided message

func (UILevelWriter) Tracef

func (l UILevelWriter) Tracef(msg string, args ...interface{})

Tracef used to log trace related messages

func (UILevelWriter) Warnf

func (l UILevelWriter) Warnf(msg string, args ...interface{})

Warnf used to log warning related messages

type UIPrefixWriter

type UIPrefixWriter struct {
	goui.UI
	// contains filtered or unexported fields
}

UIPrefixWriter prints a prefix when the underlying ui prints a message

func NewUIPrefixedWriter

func NewUIPrefixedWriter(prefix string, ui goui.UI) *UIPrefixWriter

NewUIPrefixedWriter constructor for building a UI with a prefix when logging a message

func (*UIPrefixWriter) BeginLinef

func (w *UIPrefixWriter) BeginLinef(msg string, args ...interface{})

BeginLinef writes a message and args adding a configured prefix

func (*UIPrefixWriter) Write

func (w *UIPrefixWriter) Write(data []byte) (int, error)

type UIWithLevels

type UIWithLevels interface {
	Errorf(msg string, args ...interface{})
	Warnf(msg string, args ...interface{})
	Debugf(msg string, args ...interface{})
	Tracef(msg string, args ...interface{})
}

UIWithLevels wraps a ui.UI with logging levels

type WithDigest

type WithDigest interface {
	Digest() (regv1.Hash, error)
}

WithDigest are items that Digest() can be called on

Jump to

Keyboard shortcuts

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