package exec
import "github.com/centrifuge/go-substrate-rpc-client/v4/registry/exec"
Index ¶
- Variables
- type Error
- type NewRetryableExecutorMockT
- type Opts
- type OptsFn
- func WithMaxRetryCount(maxRetryCount uint) OptsFn
- func WithRetryOnFallBackError(retryOnFallbackError bool) OptsFn
- func WithRetryTimeout(retryTimeout time.Duration) OptsFn
- type RetryableExecutor
- type RetryableExecutorMock
Variables ¶
var ( ErrMissingExecFn = errors.New("no exec function provided") ErrMissingFallbackFn = errors.New("no fallback function provided") )
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error holds none or multiple errors that can happen during execution.
func (*Error) AddErr ¶
AddErr appends an error to the error slice of Error.
func (*Error) Error ¶
Error implements the standard error interface.
type NewRetryableExecutorMockT ¶
type Opts ¶
type Opts struct {
// contains filtered or unexported fields
}
Opts holds the configurable options for a RetryableExecutor.
func NewDefaultExecOpts ¶
func NewDefaultExecOpts() *Opts
NewDefaultExecOpts creates the default Opts.
type OptsFn ¶
type OptsFn func(opts *Opts)
OptsFn is function that operate on Opts.
func WithMaxRetryCount ¶
WithMaxRetryCount sets the max retry count.
Note that a default value is provided if the provided count is 0.
func WithRetryOnFallBackError ¶
WithRetryOnFallBackError sets the retryOnFallbackError flag.
func WithRetryTimeout ¶
WithRetryTimeout sets the retry timeout.
type RetryableExecutor ¶
type RetryableExecutor[T any] interface { ExecWithFallback(execFn func() (T, error), fallbackFn func() error) (T, error) }
RetryableExecutor is the interface used for executing a closure and its fallback if the initial execution fails.
The interface is generic over type T which represents the return value of the closure.
func NewRetryableExecutor ¶
func NewRetryableExecutor[T any](opts ...OptsFn) RetryableExecutor[T]
NewRetryableExecutor creates a new RetryableExecutor.
type RetryableExecutorMock ¶
RetryableExecutorMock is an autogenerated mock type for the RetryableExecutor type
func NewRetryableExecutorMock ¶
func NewRetryableExecutorMock[T interface{}](t NewRetryableExecutorMockT) *RetryableExecutorMock[T]
NewRetryableExecutorMock creates a new instance of RetryableExecutorMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*RetryableExecutorMock[T]) ExecWithFallback ¶
func (_m *RetryableExecutorMock[T]) ExecWithFallback(execFn func() (T, error), fallbackFn func() error) (T, error)
ExecWithFallback provides a mock function with given fields: execFn, fallbackFn
Source Files ¶
- Version
- v4.2.1 (latest)
- Published
- Dec 5, 2023
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 weeks ago –
Tools for package owners.