This commit is contained in:
John Smith
2022-02-15 13:40:17 -05:00
parent 125901fcd8
commit 7458d0d991
12 changed files with 191 additions and 103 deletions

View File

@@ -168,6 +168,7 @@ pub enum VeilidUpdate {
Attachment {
state: AttachmentState,
},
Shutdown,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -1216,28 +1217,6 @@ impl VeilidAPI {
Ok(())
}
// wait for a matching update
pub async fn wait_for_update(
&self,
update: VeilidUpdate,
timeout_ms: Option<u32>,
) -> Result<(), VeilidAPIError> {
match update {
VeilidUpdate::Log {
log_level: _,
message: _,
} => {
// No point in waiting for a log
}
VeilidUpdate::Attachment { state } => {
self.attachment_manager()?
.wait_for_state(state, timeout_ms)
.await;
}
}
Ok(())
}
// Change api logging level if it is enabled
pub async fn change_api_log_level(&self, log_level: VeilidConfigLogLevel) {
ApiLogger::change_log_level(log_level.to_level_filter());