Help us shape the future of Go! Take the 2026 Go Developer Survey

workflowstate

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSignalChannel

func GetSignalChannel[T any](ctx sync.Context, wf *WfState, name string) sync.Channel[T]

func NewReplayLogger

func NewReplayLogger(replayer Replayer, logger *slog.Logger) *slog.Logger

func ReceiveSignal

func ReceiveSignal(wf *WfState, name string, arg payload.Payload)

func WithWorkflowState

func WithWorkflowState(ctx sync.Context, wfState *WfState) sync.Context

Types

type DecodingSettable

type DecodingSettable struct {
	Set  func(v payload.Payload, err error) error
	Name string
}

func AsDecodingSettable

func AsDecodingSettable[T any](cv converter.Converter, name string, f sync.SettableFuture[T]) *DecodingSettable

Use this to track futures for the workflow state. It's required to map the generic Future interface to a type without type parameters.

type Replayer

type Replayer interface {
	Replaying() bool
}

type WfState

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

func NewWorkflowState

func NewWorkflowState(instance *core.WorkflowInstance, logger *slog.Logger, tracer trace.Tracer, clock clock.Clock) *WfState

func WorkflowState

func WorkflowState(ctx sync.Context) *WfState

func (*WfState) AddCommand

func (wf *WfState) AddCommand(cmd command.Command)

func (*WfState) CommandByScheduleEventID

func (wf *WfState) CommandByScheduleEventID(scheduleEventID int64) command.Command

func (*WfState) Commands

func (wf *WfState) Commands() []command.Command

func (*WfState) FutureByScheduleEventID

func (wf *WfState) FutureByScheduleEventID(scheduleEventID int64) (*DecodingSettable, bool)

func (*WfState) GetNextScheduleEventID

func (wf *WfState) GetNextScheduleEventID() int64

func (*WfState) HasPendingFutures

func (wf *WfState) HasPendingFutures() bool

func (*WfState) Instance

func (wf *WfState) Instance() *core.WorkflowInstance

func (*WfState) Logger

func (wf *WfState) Logger() *slog.Logger

func (*WfState) PendingFutureNames

func (wf *WfState) PendingFutureNames() map[int64]string

func (*WfState) RemoveFuture

func (wf *WfState) RemoveFuture(scheduleEventID int64)

func (*WfState) Replaying

func (wf *WfState) Replaying() bool

func (*WfState) SetReplaying

func (wf *WfState) SetReplaying(replaying bool)

func (*WfState) SetTime

func (wf *WfState) SetTime(t time.Time)

func (*WfState) Time

func (wf *WfState) Time() time.Time

func (*WfState) Tracer

func (wf *WfState) Tracer() trace.Tracer

func (*WfState) TrackFuture

func (wf *WfState) TrackFuture(scheduleEventID int64, f *DecodingSettable)

Jump to

Keyboard shortcuts

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