dummy

package
v1.25.0-117.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

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
}

func (TimerTask) Concurrent

func (TimerTask) Concurrent() bool

func (TimerTask) Kind

func (t TimerTask) Kind() hsm.TaskKind

func (TimerTask) Type

func (TimerTask) Type() string

type TimerTaskSerializer

type TimerTaskSerializer struct{}

func (TimerTaskSerializer) Deserialize

func (TimerTaskSerializer) Deserialize(data []byte, kind hsm.TaskKind) (hsm.Task, error)

func (TimerTaskSerializer) Serialize

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

Jump to

Keyboard shortcuts

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