Skip to content

Commit

Permalink
feat(schema): revise transitions and states (#177)
Browse files Browse the repository at this point in the history
* feat(schema): rename 'loaded' state to 'inactive' for controllers

* feat(schema): add additional lifecycle transitions to components

* docs: changelog

* refactor: move on_shutdown transition further down in the order

* feat: update static generated schemas
  • Loading branch information
eeberhard authored Sep 20, 2024
1 parent d90a719 commit e133207
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
9 changes: 6 additions & 3 deletions docs/static/schemas/draft/2-0-0/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ export type ComponentState =
/**
* The runtime state of the controller
*/
export type ControllerState = "unloaded" | "loaded" | "active";
export type ControllerState = "unloaded" | "inactive" | "active";
/**
* The runtime state of the hardware interface
*/
export type HardwareState = "unloaded" | "loaded";
/**
* The runtime state of the sequence
*/
export type SequenceState = "inactive" | "active";
export type SequenceState = "inactive" | "active" | "aborted";
/**
* True only when every listed item is true
*/
Expand Down Expand Up @@ -719,8 +719,11 @@ export interface ComponentStateTransitions {
on_activate?: Events;
on_deactivate?: Events;
on_cleanup?: Events;
on_shutdown?: Events;
on_configure_failure?: Events;
on_activate_failure?: Events;
on_error?: Events;
on_error_recovery?: Events;
on_shutdown?: Events;
on_unload?: Events;
}

Expand Down
16 changes: 13 additions & 3 deletions docs/static/schemas/draft/2-0-0/application.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,21 @@
"on_cleanup": {
"$ref": "#/$defs/events"
},
"on_shutdown": {
"on_configure_failure": {
"$ref": "#/$defs/events"
},
"on_activate_failure": {
"$ref": "#/$defs/events"
},
"on_error": {
"$ref": "#/$defs/events"
},
"on_error_recovery": {
"$ref": "#/$defs/events"
},
"on_shutdown": {
"$ref": "#/$defs/events"
},
"on_unload": {
"$ref": "#/$defs/events"
}
Expand Down Expand Up @@ -685,7 +694,7 @@
"type": "string",
"enum": [
"unloaded",
"loaded",
"inactive",
"active"
]
}
Expand Down Expand Up @@ -735,7 +744,8 @@
"type": "string",
"enum": [
"inactive",
"active"
"active",
"aborted"
]
}
},
Expand Down
2 changes: 2 additions & 0 deletions schemas/applications/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Release Versions:
- A running application can be stopped with the `application: stop` event from any event source
- Components, controllers and hardware support dedicated transition events such as `on_load`, `on_activate`
and `on_error` which behave as event triggers similar to predicates
- Lifecycle components have access to additional error handling with the `on_configure_failure`, `on_activate_failure`,
`on_error` and `on_error_recovery` transition events
- Condition sources for sequence steps and conditions now include component, controller, hardware or sequence states in
addition to the previous component or controller predicate sources
- Hardware control rate can be supplemented with a `rate_tolerance` to determine the allowable deviation from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"type": "string",
"enum": [
"unloaded",
"loaded",
"inactive",
"active"
]
}
Expand Down Expand Up @@ -165,7 +165,8 @@
"type": "string",
"enum": [
"inactive",
"active"
"active",
"aborted"
]
}
},
Expand Down
11 changes: 10 additions & 1 deletion schemas/applications/schema/components.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,21 @@
"on_cleanup": {
"$ref": "events.schema.json"
},
"on_shutdown": {
"on_configure_failure": {
"$ref": "events.schema.json"
},
"on_activate_failure": {
"$ref": "events.schema.json"
},
"on_error": {
"$ref": "events.schema.json"
},
"on_error_recovery": {
"$ref": "events.schema.json"
},
"on_shutdown": {
"$ref": "events.schema.json"
},
"on_unload": {
"$ref": "events.schema.json"
}
Expand Down

0 comments on commit e133207

Please sign in to comment.