Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCheckNoUpdate = errors.New("selected target is already running")
)
View Source
var (
ErrStartFailed = errors.New("start failed")
)
Functions ¶
This section is empty.
Types ¶
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
SkipIfRunning 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 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) 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 *events.EventSender
Client *client.GatewayClient
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
Click to show internal directories.
Click to hide internal directories.