Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Retry ¶
func Retry(fn func() error, options *RetryOptions) error
Types ¶
type CompensateFunc ¶
type CompensateFunc func() error
type ConstantBackoff ¶
func (*ConstantBackoff) NextInterval ¶
func (b *ConstantBackoff) NextInterval() time.Duration
type ExponentialBackoff ¶
type ExponentialBackoff struct { InitialInterval time.Duration MaxInterval time.Duration Multiplier float64 RandomFactor float64 CurrentInterval time.Duration }
func (*ExponentialBackoff) NextInterval ¶
func (b *ExponentialBackoff) NextInterval() time.Duration
type RetryOptions ¶
func (*RetryOptions) AppendUnrecoverableErrors ¶
func (t *RetryOptions) AppendUnrecoverableErrors(errs ...error)
type SagaTx ¶
type SagaTx struct { *RetryOptions // contains filtered or unexported fields }
func NewSagaTx ¶
func NewSagaTx(options ...SagaTxOption) *SagaTx
func (*SagaTx) Append ¶
func (t *SagaTx) Append(txFunc UpdateFunc, rollbackFunc CompensateFunc)
func (*SagaTx) Do ¶
func (t *SagaTx) Do(txFunc UpdateFunc, rollbackFunc CompensateFunc) (updateErrors error, compensateErrors error)
type SagaTxOption ¶
type SagaTxOption func(*SagaTx)
func WithAsync ¶
func WithAsync(async bool) SagaTxOption
func WithRetries ¶
func WithRetries(retryOptions *RetryOptions) SagaTxOption
type Transactor ¶
type Transactor interface { Append(txFunc UpdateFunc, rollbackFunc CompensateFunc) Do(txFunc UpdateFunc, rollbackFunc CompensateFunc) (updateErrors error, compensateErrors error) ExecuteAll(ctx context.Context) (updateErrors error, compensateErrors error) }
type UpdateFunc ¶
type UpdateFunc func() error
Click to show internal directories.
Click to hide internal directories.