dummy

package
v1.26.2-121.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 6 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 {
	Destination string
}

func (ImmediateTask) Concurrent

func (ImmediateTask) Concurrent() bool

func (ImmediateTask) Kind

func (t ImmediateTask) Kind() hsm.TaskKind

func (ImmediateTask) Type

func (ImmediateTask) Type() string

type ImmediateTaskSerializer

type ImmediateTaskSerializer struct{}

func (ImmediateTaskSerializer) Deserialize

func (ImmediateTaskSerializer) Deserialize(data []byte, kind hsm.TaskKind) (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 {
	Deadline time.Time
	// contains filtered or unexported fields
}

func (TimerTask) Concurrent

func (t TimerTask) Concurrent() bool

func (TimerTask) Kind

func (t TimerTask) Kind() hsm.TaskKind

func (TimerTask) Type

func (TimerTask) Type() string

func (TimerTask) Validate added in v1.26.0

func (t TimerTask) Validate(*hsm.Node) error

type TimerTaskSerializer

type TimerTaskSerializer struct{}

func (TimerTaskSerializer) Deserialize

func (TimerTaskSerializer) Deserialize(data []byte, kind hsm.TaskKind) (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