retry

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 4 Imported by: 0

README

retry

该目录只是对外公开的便捷转发层。

  • 面向业务代码提供 gorp/retry 入口
  • 真实实现仍在 framework/*
  • 不在这里承载独立重试实现或新语义

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRetryPolicy

func DefaultRetryPolicy() resiliencecontract.RetryPolicy

DefaultRetryPolicy returns the built-in default retry policy. DefaultRetryPolicy 返回默认重试策略。

func Do

func Do(ctx context.Context, c runtimecontract.Container, fn func() error) error

Do executes a function with the retry service from the container. Do 使用容器中的重试服务执行函数。

Example:

err := retry.Do(ctx, c, func() error {
    return callRemote(ctx)
})

func DoWithResult

func DoWithResult(ctx context.Context, c runtimecontract.Container, fn func() (any, error)) (any, error)

DoWithResult executes a function with result using the retry service from the container. DoWithResult 使用容器中的重试服务执行带返回值的函数。

func Get

Get returns the unified retry service from the container. Get 从容器获取统一重试服务。

func GetOrPanic

GetOrPanic returns the unified retry service from the container and panics on failure. GetOrPanic 从容器获取统一重试服务,失败 panic。

func IsRetryable

func IsRetryable(c runtimecontract.Container, err error) (bool, error)

IsRetryable reports whether the given error is retryable. IsRetryable 判断错误是否可重试。

Types

type Retry

type Retry = resiliencecontract.Retry

Retry is the top-level alias of the retry contract. Retry 是重试契约的顶层别名。

type RetryConfig

type RetryConfig = resiliencecontract.RetryConfig

RetryConfig is the top-level alias of the retry config contract. RetryConfig 是重试配置契约的顶层别名。

type RetryPolicy

type RetryPolicy = resiliencecontract.RetryPolicy

RetryPolicy is the top-level alias of the retry policy contract. RetryPolicy 是重试策略契约的顶层别名。

Jump to

Keyboard shortcuts

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