Documentation
¶
Overview ¶
Package deviceapp coordinates the single engine and its device owner across requests, planners, settings changes and shutdown.
Index ¶
- type Lifecycle
- func (l *Lifecycle) Admit(selectOwner func() (string, bool, error), build func() (*motion.Engine, error)) (*motion.Engine, uint64, error)
- func (l *Lifecycle) ApplySettings(ctx context.Context, settings config.MotionSettings) error
- func (l *Lifecycle) Current() (*motion.Engine, string)
- func (l *Lifecycle) Hold() func()
- func (l *Lifecycle) HoldSettings() func()
- func (l *Lifecycle) Install(engine *motion.Engine, owner string)
- func (l *Lifecycle) Resume(ctx context.Context, engine *motion.Engine, ...) (motion.ActiveMotionState, error)
- func (l *Lifecycle) Retire(ctx context.Context, reason string) error
- func (l *Lifecycle) Stop(ctx context.Context, reason string, outside func(string) error, ...) (StopResult, error)
- type StopResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle serializes owner replacement and Stop independently of settings persistence. Stop can cancel a Resume already waiting on a transport.
func (*Lifecycle) Admit ¶
func (l *Lifecycle) Admit(selectOwner func() (string, bool, error), build func() (*motion.Engine, error)) (*motion.Engine, uint64, error)
Admit selects or builds one engine and captures its Stop generation before releasing admission.
func (*Lifecycle) ApplySettings ¶
ApplySettings updates the retained engine, including a paused run.
func (*Lifecycle) Current ¶
Current returns a consistent engine/owner pair without waiting for wire I/O.
func (*Lifecycle) Hold ¶
func (l *Lifecycle) Hold() func()
Hold pins the selected engine across a compound admission or safety operation.
func (*Lifecycle) HoldSettings ¶
func (l *Lifecycle) HoldSettings() func()
HoldSettings spans a saved mutation and its runtime transitions.
func (*Lifecycle) Resume ¶
func (l *Lifecycle) Resume(ctx context.Context, engine *motion.Engine, latest func() config.MotionSettings) (motion.ActiveMotionState, error)
Resume re-reads persisted settings under the same serialization used by edits.
func (*Lifecycle) Retire ¶
Retire removes the binding before draining it. The caller holds admission.
func (*Lifecycle) Stop ¶
func (l *Lifecycle) Stop(ctx context.Context, reason string, outside func(string) error, fallback func() (transport.CommandResult, error)) (StopResult, error)
Stop dispatches exactly one of engine Stop or the fallback. The caller holds admission until it publishes completion to any overlapping Stop requests.
type StopResult ¶
type StopResult struct {
State motion.ActiveMotionState
Engine bool
Result transport.CommandResult
}
StopResult carries the outcome from the engine or the fallback device path.