-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eventing): add io-engine events
Signed-off-by: Vandana Varakantham <[email protected]>
- Loading branch information
1 parent
5c3ae08
commit edde7a5
Showing
6 changed files
with
78 additions
and
10 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use events_api::event::{ | ||
EventAction, | ||
EventCategory, | ||
EventMessage, | ||
EventMeta, | ||
EventSource, | ||
}; | ||
|
||
use crate::{ | ||
core::{MayastorEnvironment, Reactor}, | ||
eventing::Event, | ||
}; | ||
|
||
// Io-engine event message from Mayastor env data. | ||
impl Event for MayastorEnvironment { | ||
fn event(&self, event_action: EventAction) -> EventMessage { | ||
let event_source = EventSource::new(self.node_name.clone()); | ||
EventMessage { | ||
category: EventCategory::IoEngineCategory as i32, | ||
action: event_action as i32, | ||
target: self.name.clone(), | ||
metadata: Some(EventMeta::from_source(event_source)), | ||
} | ||
} | ||
} | ||
|
||
// Reactor event message from Reactor data. | ||
impl Event for Reactor { | ||
fn event(&self, event_action: EventAction) -> EventMessage { | ||
let event_source = EventSource::new( | ||
MayastorEnvironment::global_or_default().node_name, | ||
) | ||
.with_reactor_details( | ||
self.core().into(), | ||
&self.get_state().to_string(), | ||
); | ||
EventMessage { | ||
category: EventCategory::IoEngineCategory as i32, | ||
action: event_action as i32, | ||
target: self.tid().to_string(), | ||
metadata: Some(EventMeta::from_source(event_source)), | ||
} | ||
} | ||
} |
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