-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cycle Id. Each time a new instance of SysInspect runner starts, i…
…t will have an unique Id for the current cycle
- Loading branch information
Showing
4 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
use crate::minion::SysMinion; | ||
use async_trait::async_trait; | ||
use libsysinspect::{intp::actproc::response::ActionResponse, reactor::callback::EventProcessorCallback, SysinspectError}; | ||
use libsysinspect::{SysinspectError, intp::actproc::response::ActionResponse, reactor::callback::EventProcessorCallback}; | ||
use std::sync::Arc; | ||
use uuid::Uuid; | ||
|
||
#[derive(Debug)] | ||
pub struct ActionResponseCallback { | ||
cid: String, | ||
minion: Arc<SysMinion>, | ||
} | ||
|
||
impl ActionResponseCallback { | ||
pub(crate) fn new(minion: Arc<SysMinion>) -> Self { | ||
Self { minion } | ||
Self { minion, cid: Uuid::new_v4().to_string() } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl EventProcessorCallback for ActionResponseCallback { | ||
async fn on_action_response(&mut self, ar: ActionResponse) -> Result<(), SysinspectError> { | ||
async fn on_action_response(&mut self, mut ar: ActionResponse) -> Result<(), SysinspectError> { | ||
ar.set_cid(self.cid.to_owned()); | ||
self.minion.clone().send_callback(ar).await | ||
} | ||
} |