statemachine

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright (c) Ultraviolet SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action func(State)

type Event

type Event interface {
	String() string
}

type State

type State interface {
	String() string
}

type StateMachine

type StateMachine interface {
	AddTransition(t Transition)
	SetAction(state State, action Action)
	GetState() State
	SendEvent(event Event)
	Start(ctx context.Context) error
	Reset(initialState State)
}

func NewStateMachine

func NewStateMachine(initialState State) StateMachine

type Transition

type Transition struct {
	From  State
	Event Event
	To    State
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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