saga

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, handler Handler) error

Run implements the saga algorithm.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action is a single step in a saga.

func NewAction

func NewAction(name string, action, compensate ActionFunc) Action

NewAction creates a new action.

type ActionFunc

type ActionFunc func(ctx context.Context) error

ActionFunc is a generic action/compensation function. They will typically be bound receivers so that saga steps can share state between themselves.

type Handler

type Handler interface {
	Actions() []Action
}

Handler implements a saga, a set of steps to achieve a desired outcome and a set of steps to undo any state changes on failure of an action.

Jump to

Keyboard shortcuts

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