Documentation ¶
Index ¶
- Constants
- func DecorateConsumer[T any](limiter TimeLimiter, fn func(T) error) func(T) error
- func DecorateFunction[T any, R any](limiter TimeLimiter, fn func(T) (R, error)) func(T) (R, error)
- func DecorateRunnable(limiter TimeLimiter, fn func() error) func() error
- func DecorateSupplier[T any](limiter TimeLimiter, fn func() (T, error)) func() (T, error)
- type Config
- type ConfigBuilder
- type Event
- type EventListener
- type EventType
- type Metrics
- type PanicEvent
- type SuccessEvent
- type TimeLimiter
- type TimeoutError
- type TimeoutEvent
Constants ¶
View Source
const DefaultTimeoutDuration = time.Second
Variables ¶
This section is empty.
Functions ¶
func DecorateConsumer ¶
func DecorateConsumer[T any](limiter TimeLimiter, fn func(T) error) func(T) error
func DecorateFunction ¶
func DecorateFunction[T any, R any](limiter TimeLimiter, fn func(T) (R, error)) func(T) (R, error)
func DecorateRunnable ¶
func DecorateRunnable(limiter TimeLimiter, fn func() error) func() error
func DecorateSupplier ¶
func DecorateSupplier[T any](limiter TimeLimiter, fn func() (T, error)) func() (T, error)
Types ¶
type ConfigBuilder ¶
type ConfigBuilder func(*Config)
func WithTimeoutDuration ¶
func WithTimeoutDuration(timeoutDuration time.Duration) ConfigBuilder
type EventListener ¶
type EventListener interface { OnSuccessFunc(func(SuccessEvent)) EventListener OnTimeoutFunc(func(TimeoutEvent)) EventListener OnPanicFunc(func(PanicEvent)) EventListener DismissSuccessFunc(func(SuccessEvent)) EventListener DismissTimeoutFunc(func(TimeoutEvent)) EventListener DismissPanicFunc(func(PanicEvent)) EventListener OnSuccess(fn.Consumer[SuccessEvent]) EventListener OnTimeout(fn.Consumer[TimeoutEvent]) EventListener OnPanic(fn.Consumer[PanicEvent]) EventListener DismissSuccess(fn.Consumer[SuccessEvent]) EventListener DismissTimeout(fn.Consumer[TimeoutEvent]) EventListener DismissPanic(fn.Consumer[PanicEvent]) EventListener }
type PanicEvent ¶ added in v0.4.1
type SuccessEvent ¶ added in v0.4.1
type SuccessEvent interface { Event }
type TimeLimiter ¶
type TimeLimiter interface { Name() string Metrics() Metrics EventListener() EventListener Execute(func() (any, error)) (any, error) }
func NewTimeLimiter ¶
func NewTimeLimiter(name string, configs ...ConfigBuilder) TimeLimiter
type TimeoutError ¶
type TimeoutError struct {
// contains filtered or unexported fields
}
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
type TimeoutEvent ¶ added in v0.4.1
type TimeoutEvent interface { Event }
Click to show internal directories.
Click to hide internal directories.