feat: Add in the ability to get configs

config hooks
This commit is contained in:
BluJ
2023-02-09 11:16:55 -07:00
committed by Aiden McClelland
parent 9366dbb96e
commit f77a208e2c
11 changed files with 330 additions and 118 deletions

View File

@@ -66,7 +66,15 @@ impl ManageContainer {
}
pub fn to_desired(&self, new_state: StartStop) {
self.desired_state.send(new_state);
self.desired_state.send(new_state).unwrap_or_default();
}
pub async fn wait_for_desired(&self, new_state: StartStop) {
let mut current_state = self.current_state();
self.to_desired(new_state);
while *current_state.borrow() != new_state {
current_state.changed().await.unwrap_or_default();
}
}
pub fn current_state(&self) -> watch::Receiver<StartStop> {