dummy

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskTypeTimer     = "dummy.Timer"
	TaskTypeImmediate = "dummy.Immediate"
)

Variables

View Source
var StateMachineType = "dummy.Dummy"
View Source
var Transition0 = hsm.NewTransition(
	[]State{State0, State1},
	State0,
	func(sm *Dummy, e Event0) (hsm.TransitionOutput, error) {
		return hsm.TransitionOutput{}, nil
	},
)
View Source
var Transition1 = hsm.NewTransition(
	[]State{State0, State1},
	State1,
	func(sm *Dummy, e Event1) (hsm.TransitionOutput, error) {
		return hsm.TransitionOutput{}, nil
	},
)

Functions

func MachineCollection

func MachineCollection(tree *hsm.Node) hsm.Collection[*Dummy]

func RegisterExecutor

func RegisterExecutor(
	registry *hsm.Registry,
	taskExecutorOptions TaskExecutorOptions,
) error

func RegisterStateMachine

func RegisterStateMachine(r *hsm.Registry) error

func RegisterTaskSerializers

func RegisterTaskSerializers(reg *hsm.Registry) error

Types

type Dummy

type Dummy struct {
	CurrentState State
}

Dummy state machine. It's used for writing unit tests. Do not use in production!

func NewDummy

func NewDummy() *Dummy

NewDummy creates a new callback in the STANDBY state from given params.

func (Dummy) RegenerateTasks

func (sm Dummy) RegenerateTasks(*hsm.Node) ([]hsm.Task, error)

func (*Dummy) SetState

func (sm *Dummy) SetState(state State)

func (*Dummy) State

func (sm *Dummy) State() State

type Event0

type Event0 struct{}

type Event1

type Event1 struct{}

type ImmediateTask

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

func (ImmediateTask) Deadline

func (ImmediateTask) Deadline() time.Time

func (ImmediateTask) Destination

func (t ImmediateTask) Destination() string

func (ImmediateTask) Type

func (ImmediateTask) Type() string

func (ImmediateTask) Validate

func (ImmediateTask) Validate(ref *persistencespb.StateMachineRef, node *hsm.Node) error

type ImmediateTaskSerializer

type ImmediateTaskSerializer struct{}

func (ImmediateTaskSerializer) Deserialize

func (ImmediateTaskSerializer) Deserialize(data []byte, attrs hsm.TaskAttributes) (hsm.Task, error)

func (ImmediateTaskSerializer) Serialize

func (ImmediateTaskSerializer) Serialize(hsm.Task) ([]byte, error)

type State

type State int
const (
	State0 State = iota
	State1
)

type TaskExecutorOptions

type TaskExecutorOptions struct {
	ImmediateExecutor hsm.ImmediateExecutor[ImmediateTask]
	TimerExecutor     hsm.TimerExecutor[TimerTask]
}

type TimerTask

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

func (TimerTask) Deadline

func (t TimerTask) Deadline() time.Time

func (TimerTask) Destination

func (TimerTask) Destination() string

func (TimerTask) Type

func (TimerTask) Type() string

func (TimerTask) Validate

func (t TimerTask) Validate(ref *persistencespb.StateMachineRef, node *hsm.Node) error

type TimerTaskSerializer

type TimerTaskSerializer struct{}

func (TimerTaskSerializer) Deserialize

func (TimerTaskSerializer) Deserialize(data []byte, attrs hsm.TaskAttributes) (hsm.Task, error)

func (TimerTaskSerializer) Serialize

func (s TimerTaskSerializer) Serialize(task hsm.Task) ([]byte, error)

Jump to

Keyboard shortcuts

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