utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const Infinitely = -1

Variables

View Source
var ErrMaxRetriesExceeded = errors.New("maximum number of retries exceeded")

Functions

func GenerateBytesUUID

func GenerateBytesUUID() []byte

GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes

func GenerateUUID

func GenerateUUID() string

GenerateUUID returns a UUID based on RFC 4122

func GenerateUUIDOnlyLetters

func GenerateUUIDOnlyLetters() string

GenerateUUIDOnlyLetters returns a UUID without digits

func NewProbabilisticRetryRunner

func NewProbabilisticRetryRunner(maxTimes int, interval int64, expBackoff bool) *retryRunner

NewProbabilisticRetryRunner returns a new runner that sets delay to time.Duration(rand.Int63n(f.interval)+1) * time.Millisecond

func NewRetryRunner

func NewRetryRunner(maxTimes int, delay time.Duration, expBackoff bool) *retryRunner

func NewTypedRetryRunner

func NewTypedRetryRunner[V any](maxTimes int, delay time.Duration, expBackoff bool) *typedRetryRunner[V]

Types

type RetryRunner

type RetryRunner interface {
	Run(func() error) error
	RunWithErrors(runner func() (bool, error)) error
}

RetryRunner receives a function that potentially fails and retries according to the specified strategy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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