network

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is429Or5XXError

func Is429Or5XXError(err error) bool

func RetryWithClient

func RetryWithClient[T any, R any](ctx context.Context, p *ProtonClientRetryWrapper[T], f func(context.Context, T) (R, error)) (R, error)

Types

type CoolDownProvider

type CoolDownProvider interface {
	GetNextWaitTime() time.Duration
	Reset()
}

type ExpCoolDown

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

func (*ExpCoolDown) GetNextWaitTime

func (c *ExpCoolDown) GetNextWaitTime() time.Duration

func (*ExpCoolDown) Reset

func (c *ExpCoolDown) Reset()

type NoCoolDown

type NoCoolDown struct{}

func (*NoCoolDown) GetNextWaitTime

func (c *NoCoolDown) GetNextWaitTime() time.Duration

func (*NoCoolDown) Reset

func (c *NoCoolDown) Reset()

type ProtonClientRetryWrapper

type ProtonClientRetryWrapper[T any] struct {
	// contains filtered or unexported fields
}

func NewClientRetryWrapper

func NewClientRetryWrapper[T any](client T, coolDown CoolDownProvider) *ProtonClientRetryWrapper[T]

func (*ProtonClientRetryWrapper[T]) DidEncounter429or5xx

func (p *ProtonClientRetryWrapper[T]) DidEncounter429or5xx() bool

func (*ProtonClientRetryWrapper[T]) Retry

func (p *ProtonClientRetryWrapper[T]) Retry(ctx context.Context, f func(context.Context, T) error) error

Jump to

Keyboard shortcuts

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