refactor power_event_watcher for configurable subscriber behavior #1764
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To support the windows watchdog efforts, we will be re-using the
power_event_watcher
code from the watchdog service. Currently the power_event_watcher component takes a knapsack reference and directly manipulates theInModernStandby
value as a result of the observed events. These are also persisted to bbolt, making this a little tricky for sharing with a separate service as is.We can't simply read the values from bbolt within watchdog because if launcher proper stops functioning (and requires watchdog intervention) we shouldn't trust the latest stored value.
We also likely won't want two versions of the same logs always being added from both watchdog and launcher, and I didn't want to just duplicate all of this code. This was the cleanest approach I could come up with, and should allow watchdog to simply define a new
powerEventSubscriber
(and avoid knapsack/stores setup). happy to hear any alternative suggestions!