statemachine

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanTransition

func CanTransition(from, to domain.State) bool

CanTransition returns true if a transition from `from` to `to` is allowed.

func GetNextStates

func GetNextStates(from domain.State) []domain.State

GetNextStates returns all valid next states from the given state.

func IsActiveProcessingState added in v0.26.0

func IsActiveProcessingState(state domain.State) bool

IsActiveProcessingState returns true if the state represents an active processing state that should notify on completion

func IsAllowedStateForJobUpdate

func IsAllowedStateForJobUpdate(state domain.State) bool

IsAllowedStateForJobUpdate checks if the state is allowed for the job update endpoint

func IsFailureState

func IsFailureState(state domain.State) bool

IsFailureState returns true if the state represents a failure condition.

func IsRejectedOrReverting

func IsRejectedOrReverting(state domain.State) bool

IsRejectedOrReverting returns true if the state is rejected or reverting.

func IsTerminalState

func IsTerminalState(state domain.State) bool

IsTerminalState returns true if the state has no outgoing transitions.

func ValidateTransition

func ValidateTransition(from, to domain.State) error

ValidateTransition validates a transition or returns a TransitionError.

Types

type TransitionError

type TransitionError struct {
	From domain.State
	To   domain.State
}

TransitionError is returned when an invalid transition is requested.

func (*TransitionError) Error

func (e *TransitionError) Error() string

Error returns the error message for a TransitionError.

Jump to

Keyboard shortcuts

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