Type Parameters:
R: any BaseAbortablePolicy provides a base for implementing policies that can be aborted or canceled.(*BaseAbortablePolicy[R]) AbortIf(predicate func(R, error) bool)(*BaseAbortablePolicy[R]) AbortOnErrorTypes(errs ...any)(*BaseAbortablePolicy[R]) AbortOnErrors(errs ...error)(*BaseAbortablePolicy[R]) AbortOnResult(result R)(*BaseAbortablePolicy[R]) IsAbortable(result R, err error) bool(*BaseAbortablePolicy[R]) IsConfigured() bool
Type Parameters:
R: any AttemptStartTime returns the time that the most recent execution attempt started at. Attempts returns the number of execution attempts so far, including attempts that are currently in progress and
attempts that were blocked before being executed, such as by a CircuitBreaker or RateLimiter. These can include an initial
execution along with retries and hedges. Cancel cancels the execution with the result. Canceled returns a channel that is closed when the execution is canceled, either by an external Context or a
timeout.Timeout. Context returns the context configured for the execution, else context.Background if none was configured. For
executions involving a timeout or hedge, each attempt will get a separate child context. CopyForCancellable creates a cancellable child copy of the execution based on the current execution's context. CopyForHedge creates a copy of the execution marked as a hedge. CopyWithResult returns a copy of the failsafe.Execution with the result. If the result is nil, this will preserve a
copy of the lastResult and lastError. This is useful before passing the execution to an event listener, otherwise
these may be changed if the execution is canceled. ElapsedAttemptTime returns the elapsed time since the last execution attempt began. ElapsedTime returns the elapsed time since initial execution attempt began. Executions returns the number of completed executions. Executions that are blocked, such as when a CircuitBreaker is
open, are not counted. Hedges returns the number of hedges that have been executed so far, including hedges that are currently in progress. InitializeRetry prepares a new execution retry. If the retry could not be initialized because was canceled, the associated
cancellation result is returned. IsCanceled returns whether the execution has been canceled by an external Context or a timeout.Timeout. IsCanceledWithResult returns whether the execution is canceled, along with the cancellation result, if any. IsFirstAttempt returns true when Attempts is 1, meaning this is the first execution attempt. IsHedge returns true when the execution is part of a hedged attempt. IsRetry returns true when Attempts is > 1, meaning the execution is being retried. LastError returns the error, if any, from the last execution attempt. LastResult returns the result, if any, from the last execution attempt. RecordResult records an execution result, such as before a retry attempt, and returns the result or the cancel result,
if any. Retries returns the number of retries so far, including retries that are currently in progress. StartTime returns the time that the initial execution attempt started at.
ExecutionInternal : github.com/failsafe-go/failsafe-go.Execution[R]
ExecutionInternal : github.com/failsafe-go/failsafe-go.ExecutionAttempt[R]
ExecutionInternal : github.com/failsafe-go/failsafe-go.ExecutionInfo[R]
func (*BaseExecutor)[R].OnFailure(exec ExecutionInternal[R], result *common.PolicyResult[R]) *common.PolicyResult[R]
func (*BaseExecutor)[R].OnSuccess(exec ExecutionInternal[R], result *common.PolicyResult[R])
func (*BaseExecutor)[R].PostExecute(exec ExecutionInternal[R], er *common.PolicyResult[R]) *common.PolicyResult[R]
func (*BaseExecutor)[R].PreExecute(_ ExecutionInternal[R]) *common.PolicyResult[R]
func Executor[R].OnFailure(exec ExecutionInternal[R], result *common.PolicyResult[R]) *common.PolicyResult[R]
func Executor[R].OnSuccess(exec ExecutionInternal[R], result *common.PolicyResult[R])
func Executor[R].PostExecute(exec ExecutionInternal[R], result *common.PolicyResult[R]) *common.PolicyResult[R]
func Executor[R].PreExecute(exec ExecutionInternal[R]) *common.PolicyResult[R]
Type Parameters:
R: any Executor handles execution and execution results according to a policy. May contain pre-execution and
post-execution behaviors. Each Executor makes its own determination about whether an execution result is a
success or failure. Apply performs an execution by calling PreExecute and returning any result, else calling the innerFn PostExecute.
If an Executor delays or blocks during execution, it must check that the execution was not canceled in the
meantime, else return the ExecutionInternal.Result if it was. IsFailure returns whether the result is a failure according to the corresponding policy. OnFailure performs post-execution handling for a result that is considered a failure according to IsFailure, possibly
creating a new result, else returning the original result. OnSuccess performs post-execution handling for a result that is considered a success according to IsFailure. PostExecute performs synchronous post-execution handling for an execution result. PreExecute is called before execution to return an alternative result or error, such as if execution is not allowed or
needed.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.