Documentation ¶
Index ¶
- Variables
- func Go(ctx Context, f func(ctx Context))
- func Now(ctx sync.Context) time.Time
- func Replaying(ctx sync.Context) bool
- func Select(ctx Context, cases ...SelectCase)
- func Sleep(ctx sync.Context, d time.Duration) error
- func WithCancel(parent Context) (ctx Context, cancel CancelFunc)
- func WorkflowInstance(ctx sync.Context) core.WorkflowInstance
- type ActivityOptions
- type CancelFunc
- type Channel
- type Context
- type Future
- func CreateSubWorkflowInstance[TResult any](ctx sync.Context, options SubWorkflowOptions, workflow interface{}, ...) Future[TResult]
- func ExecuteActivity[TResult any](ctx sync.Context, options ActivityOptions, activity interface{}, ...) Future[TResult]
- func ScheduleTimer(ctx Context, delay time.Duration) Future[struct{}]
- func SideEffect[TResult any](ctx sync.Context, f func(ctx sync.Context) TResult) Future[TResult]
- type Instance
- type RetryOptions
- type SelectCase
- type SubWorkflowOptions
- type WaitGroup
- type Workflow
Constants ¶
This section is empty.
Variables ¶
View Source
var Canceled = sync.Canceled
View Source
var DefaultActivityOptions = ActivityOptions{ RetryOptions: DefaultRetryOptions, }
View Source
var DefaultRetryOptions = RetryOptions{
MaxAttempts: 3,
BackoffCoefficient: 1,
}
View Source
var DefaultSubWorkflowOptions = SubWorkflowOptions{ RetryOptions: DefaultRetryOptions, }
Functions ¶
func Select ¶
func Select(ctx Context, cases ...SelectCase)
func WithCancel ¶
func WithCancel(parent Context) (ctx Context, cancel CancelFunc)
WithCancel returns a copy of parent with a new Done channel. The returned context's Done channel is closed when the returned cancel function is called or when the parent context's Done channel is closed, whichever happens first.
Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.
func WorkflowInstance ¶ added in v0.0.3
func WorkflowInstance(ctx sync.Context) core.WorkflowInstance
Types ¶
type ActivityOptions ¶
type ActivityOptions struct {
RetryOptions RetryOptions
}
type CancelFunc ¶
type CancelFunc = sync.CancelFunc
type Channel ¶
type Channel[T any] interface { Send(ctx Context, v T) SendNonblocking(ctx Context, v T) (ok bool) Receive(ctx Context) (v T, ok bool) ReceiveNonblocking(ctx Context) (v T, ok bool) Close() }
func NewBufferedChannel ¶
func NewChannel ¶
type Context ¶
func NewDisconnectedContext ¶
type Future ¶
type Future[T any] interface { // Get returns the value if set, blocks otherwise Get(ctx Context) (T, error) }
func CreateSubWorkflowInstance ¶
func CreateSubWorkflowInstance[TResult any](ctx sync.Context, options SubWorkflowOptions, workflow interface{}, args ...interface{}) Future[TResult]
func ExecuteActivity ¶
func ExecuteActivity[TResult any](ctx sync.Context, options ActivityOptions, activity interface{}, args ...interface{}) Future[TResult]
ExecuteActivity schedules the given activity to be executed
type Instance ¶
type Instance = core.WorkflowInstance
type RetryOptions ¶
type RetryOptions struct { // Maximum number of times to retry MaxAttempts int // Time to wait before first retry FirstRetryInterval time.Duration // Maximum delay for any individual retry attempt MaxRetryInterval time.Duration // Coeffecient for calculation the next retry delay BackoffCoefficient float64 // Timeout after which retries are aborted RetryTimeout time.Duration }
type SelectCase ¶
type SelectCase = sync.SelectCase
func Default ¶
func Default(handler func(Context)) SelectCase
type SubWorkflowOptions ¶
type SubWorkflowOptions struct { InstanceID string RetryOptions RetryOptions }
type WaitGroup ¶ added in v0.0.3
func NewWaitGroup ¶ added in v0.0.3
func NewWaitGroup() WaitGroup
Click to show internal directories.
Click to hide internal directories.