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

command

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelableCommand

type CancelableCommand interface {
	Command

	// Cancel cancels the command.
	Cancel()

	// HandleCancel handles a cancel event during replay
	HandleCancel()
}

type Command

type Command interface {
	ID() int64

	Type() string

	// State returns the current state of the command.
	State() CommandState

	// Execute processes the command in its current state and moves it to the next state.
	Execute(clock.Clock) *CommandResult

	// Commit marks the command as committed without executing it.
	Commit()

	// Done marks the command as done. This transitions the state to done and indicates that the result
	// of this command has been applied.
	Done()

	WhenDone(fn func())
}

type CommandResult

type CommandResult struct {
	State          core.WorkflowInstanceState
	Events         []*history.Event
	ActivityEvents []*history.Event
	TimerEvents    []*history.Event
	WorkflowEvents []*history.WorkflowEvent
}

type CommandState

type CommandState int
const (
	CommandState_Pending CommandState = iota
	CommandState_Committed
	CommandState_CancelPending
	CommandState_Canceled
	CommandState_Done
)

func (CommandState) String

func (cs CommandState) String() string

type CompleteWorkflowCommand

type CompleteWorkflowCommand struct {
	Instance *core.WorkflowInstance
	Result   payload.Payload
	Error    *workflowerrors.Error
	// contains filtered or unexported fields
}

func NewCompleteWorkflowCommand

func NewCompleteWorkflowCommand(id int64, instance *core.WorkflowInstance, result payload.Payload, err *workflowerrors.Error) *CompleteWorkflowCommand

func (*CompleteWorkflowCommand) Commit

func (c *CompleteWorkflowCommand) Commit()

func (*CompleteWorkflowCommand) Done

func (c *CompleteWorkflowCommand) Done()

func (*CompleteWorkflowCommand) Execute

func (c *CompleteWorkflowCommand) Execute(clock clock.Clock) *CommandResult

func (*CompleteWorkflowCommand) ID

func (c *CompleteWorkflowCommand) ID() int64

func (*CompleteWorkflowCommand) State

func (c *CompleteWorkflowCommand) State() CommandState

func (*CompleteWorkflowCommand) Type

func (c *CompleteWorkflowCommand) Type() string

func (*CompleteWorkflowCommand) WhenDone

func (c *CompleteWorkflowCommand) WhenDone(fn func())

type ContinueAsNewCommand

type ContinueAsNewCommand struct {
	Instance *core.WorkflowInstance
	Name     string
	Metadata *metadata.WorkflowMetadata
	Inputs   []payload.Payload
	Result   payload.Payload

	ContinuedExecutionID string
	// contains filtered or unexported fields
}

func NewContinueAsNewCommand

func NewContinueAsNewCommand(id int64, instance *core.WorkflowInstance, result payload.Payload, name string, metadata *metadata.WorkflowMetadata, inputs []payload.Payload) *ContinueAsNewCommand

func (*ContinueAsNewCommand) Commit

func (c *ContinueAsNewCommand) Commit()

func (*ContinueAsNewCommand) Done

func (c *ContinueAsNewCommand) Done()

func (*ContinueAsNewCommand) Execute

func (c *ContinueAsNewCommand) Execute(clock clock.Clock) *CommandResult

func (*ContinueAsNewCommand) ID

func (c *ContinueAsNewCommand) ID() int64

func (*ContinueAsNewCommand) State

func (c *ContinueAsNewCommand) State() CommandState

func (*ContinueAsNewCommand) Type

func (c *ContinueAsNewCommand) Type() string

func (*ContinueAsNewCommand) WhenDone

func (c *ContinueAsNewCommand) WhenDone(fn func())

type ScheduleActivityCommand

type ScheduleActivityCommand struct {
	Name     string
	Inputs   []payload.Payload
	Attempt  int
	Metadata *metadata.WorkflowMetadata
	Queue    core.Queue
	// contains filtered or unexported fields
}

func NewScheduleActivityCommand

func NewScheduleActivityCommand(id int64, name string, inputs []payload.Payload, attempt int, metadata *metadata.WorkflowMetadata, queue core.Queue) *ScheduleActivityCommand

func (*ScheduleActivityCommand) Commit

func (c *ScheduleActivityCommand) Commit()

func (*ScheduleActivityCommand) Done

func (c *ScheduleActivityCommand) Done()

func (*ScheduleActivityCommand) Execute

func (c *ScheduleActivityCommand) Execute(clock clock.Clock) *CommandResult

func (*ScheduleActivityCommand) ID

func (c *ScheduleActivityCommand) ID() int64

func (*ScheduleActivityCommand) State

func (c *ScheduleActivityCommand) State() CommandState

func (*ScheduleActivityCommand) Type

func (c *ScheduleActivityCommand) Type() string

func (*ScheduleActivityCommand) WhenDone

func (c *ScheduleActivityCommand) WhenDone(fn func())

type ScheduleSubWorkflowCommand

type ScheduleSubWorkflowCommand struct {
	Queue          core.Queue
	Instance       *core.WorkflowInstance
	Metadata       *metadata.WorkflowMetadata
	WorkflowSpanID [8]byte

	Name   string
	Inputs []payload.Payload
	// contains filtered or unexported fields
}

func NewScheduleSubWorkflowCommand

func NewScheduleSubWorkflowCommand(
	id int64, parentInstance *core.WorkflowInstance, subWorkflowQueue core.Queue, subWorkflowInstanceID,
	name string, inputs []payload.Payload, metadata *metadata.WorkflowMetadata, workflowSpanID [8]byte,
) *ScheduleSubWorkflowCommand

func (*ScheduleSubWorkflowCommand) Cancel

func (c *ScheduleSubWorkflowCommand) Cancel()

func (*ScheduleSubWorkflowCommand) Done

func (c *ScheduleSubWorkflowCommand) Done()

func (*ScheduleSubWorkflowCommand) Execute

func (*ScheduleSubWorkflowCommand) HandleCancel

func (c *ScheduleSubWorkflowCommand) HandleCancel()

type ScheduleTimerCommand

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

func NewScheduleTimerCommand

func NewScheduleTimerCommand(id int64, at time.Time, name string, traceContext tracing.Context) *ScheduleTimerCommand

func (*ScheduleTimerCommand) Cancel

func (c *ScheduleTimerCommand) Cancel()

func (*ScheduleTimerCommand) Done

func (c *ScheduleTimerCommand) Done()

func (*ScheduleTimerCommand) Execute

func (c *ScheduleTimerCommand) Execute(clock clock.Clock) *CommandResult

func (*ScheduleTimerCommand) HandleCancel

func (c *ScheduleTimerCommand) HandleCancel()

type SideEffectCommand

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

func NewSideEffectCommand

func NewSideEffectCommand(id int64) *SideEffectCommand

func (*SideEffectCommand) Commit

func (c *SideEffectCommand) Commit()

func (*SideEffectCommand) Done

func (c *SideEffectCommand) Done()

func (*SideEffectCommand) Execute

func (c *SideEffectCommand) Execute(clock clock.Clock) *CommandResult

func (*SideEffectCommand) ID

func (c *SideEffectCommand) ID() int64

func (*SideEffectCommand) SetResult

func (c *SideEffectCommand) SetResult(result payload.Payload)

func (*SideEffectCommand) State

func (c *SideEffectCommand) State() CommandState

func (*SideEffectCommand) Type

func (c *SideEffectCommand) Type() string

func (*SideEffectCommand) WhenDone

func (c *SideEffectCommand) WhenDone(fn func())

type StartTraceCommand

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

func NewStartTraceCommand

func NewStartTraceCommand(id int64) *StartTraceCommand

func (*StartTraceCommand) Commit

func (c *StartTraceCommand) Commit()

func (*StartTraceCommand) Done

func (c *StartTraceCommand) Done()

func (*StartTraceCommand) Execute

func (c *StartTraceCommand) Execute(clock clock.Clock) *CommandResult

func (*StartTraceCommand) ID

func (c *StartTraceCommand) ID() int64

func (*StartTraceCommand) SetSpanID

func (c *StartTraceCommand) SetSpanID(spanID payload.Payload)

func (*StartTraceCommand) State

func (c *StartTraceCommand) State() CommandState

func (*StartTraceCommand) Type

func (c *StartTraceCommand) Type() string

func (*StartTraceCommand) WhenDone

func (c *StartTraceCommand) WhenDone(fn func())

Jump to

Keyboard shortcuts

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