utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithFactor

func WithFactor(factor float64) backoffOption

func WithJitter

func WithJitter(jitter float64) backoffOption

func WithMax

func WithMax(max float64) backoffOption

func WithMin

func WithMin(min float64) backoffOption

Types

type Backoff

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

Backoff represents a backoff timer with configurable parameters.

func NewBackoff

func NewBackoff(opts ...backoffOption) *Backoff

NewBackoff creates a new Backoff instance with the given configuration.

func (*Backoff) Attempts

func (b *Backoff) Attempts() uint64

func (*Backoff) Duration

func (b *Backoff) Duration() int64

Duration returns the next backoff duration.

func (*Backoff) Reset

func (b *Backoff) Reset()

Reset resets the number of attempts to 0.

func (*Backoff) SetJitter

func (b *Backoff) SetJitter(jitter float64)

SetJitter sets the jitter factor.

func (*Backoff) SetMax

func (b *Backoff) SetMax(max float64)

SetMax sets the maximum duration (in milliseconds).

func (*Backoff) SetMin

func (b *Backoff) SetMin(min float64)

SetMin sets the minimum duration (in milliseconds).

type ParsedUrl

type ParsedUrl struct {
	*url.URL

	Hostname string
	Port     string
	Id       string
}

func Url

func Url(uri string, path string) (parsedUrl *ParsedUrl, err error)

Jump to

Keyboard shortcuts

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