finitestate

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNew       = fsm.StatusNew
	StatusBooting   = fsm.StatusBooting
	StatusRunning   = fsm.StatusRunning
	StatusReloading = fsm.StatusReloading
	StatusStopping  = fsm.StatusStopping
	StatusStopped   = fsm.StatusStopped
	StatusError     = fsm.StatusError
	StatusUnknown   = fsm.StatusUnknown
)

Variables

View Source
var TypicalTransitions = fsm.TypicalTransitions

TypicalTransitions is a set of standard transitions for a finite state machine.

Functions

This section is empty.

Types

type Machine

type Machine struct {
	*fsm.Machine
}

Machine is a wrapper around go-fsm.Machine that provides additional functionality.

func New

func New(handler slog.Handler) (*Machine, error)

New creates a new finite state machine with the specified logger using "standard" state transitions.

func (*Machine) GetStateChanWithTimeout added in v0.0.12

func (s *Machine) GetStateChanWithTimeout(ctx context.Context) <-chan string

GetStateChan returns a channel that emits the state whenever it changes. The channel is closed when the provided context is canceled.

Jump to

Keyboard shortcuts

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