state

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: BSD-3-Clause-Clear Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStartFailed = errors.New("start failed")
)

Functions

This section is empty.

Types

type ActionName

type ActionName string

ActionName Name of the state action

type ActionState

type ActionState interface {
	Name() ActionName
	Execute(ctx context.Context, updateCtx *UpdateContext) error
}

ActionState interface for all states

type Check

type Check struct {
	UpdateTargets  bool
	AllowNewUpdate bool
	Action         string
	AllowedStates  []update.State
	ToVersion      int
}

func (*Check) Execute

func (s *Check) Execute(ctx context.Context, updateCtx *UpdateContext) error

func (*Check) Name

func (s *Check) Name() ActionName

type EventSender

type EventSender struct {
	// contains filtered or unexported fields
}

func (*EventSender) FlushEvents

func (s *EventSender) FlushEvents()

func (*EventSender) SendEvent

func (s *EventSender) SendEvent(eventType events.EventTypeValue, updateID string, toTarget target.Target, success ...bool) error

type Fetch

type Fetch struct{}

func (*Fetch) Execute

func (s *Fetch) Execute(ctx context.Context, updateCtx *UpdateContext) error

func (*Fetch) Name

func (s *Fetch) Name() ActionName

type Init

type Init struct {
	CheckState bool
}

func (*Init) Execute

func (s *Init) Execute(ctx context.Context, updateCtx *UpdateContext) error

func (*Init) Name

func (s *Init) Name() ActionName

type Install

type Install struct{}

func (*Install) Execute

func (s *Install) Execute(ctx context.Context, updateCtx *UpdateContext) error

func (*Install) Name

func (s *Install) Name() ActionName

type Start

type Start struct{}

func (*Start) Execute

func (s *Start) Execute(ctx context.Context, updateCtx *UpdateContext) error

func (*Start) Name

func (s *Start) Name() ActionName

type UpdateContext

type UpdateContext struct {
	Config      *config.Config
	EventSender *EventSender

	FromTarget   target.Target
	ToTarget     target.Target
	UpdateRunner update.Runner

	CurrentState ActionName
}

UpdateContext holds the state machine context

func (*UpdateContext) SendEvent

func (u *UpdateContext) SendEvent(event events.EventTypeValue, success ...bool)

type UpdateRunner

type UpdateRunner struct {
	// contains filtered or unexported fields
}

UpdateRunner runs the OTA update states

func NewUpdateRunner

func NewUpdateRunner(states []ActionState) *UpdateRunner

func (*UpdateRunner) GetFromTarget

func (sm *UpdateRunner) GetFromTarget() target.Target

func (*UpdateRunner) Run

func (sm *UpdateRunner) Run(ctx context.Context, cfg *config.Config) error

Jump to

Keyboard shortcuts

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