-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vandana Varakantham <[email protected]>
- Loading branch information
1 parent
49495cc
commit a07260e
Showing
3 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod nexus_child_events; | ||
pub(crate) mod nexus_events; | ||
mod pool_events; | ||
mod replica_events; | ||
|
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,41 @@ | ||
use events_api::event::{ | ||
EventAction, | ||
EventCategory, | ||
EventMessage, | ||
EventMeta, | ||
EventSource, | ||
}; | ||
|
||
use mayastor_api::v1::nexus::{AddChildNexusRequest, RemoveChildNexusRequest}; | ||
|
||
use crate::{core::MayastorEnvironment, eventing::Event}; | ||
|
||
// Nexus child added event message. | ||
impl Event for AddChildNexusRequest { | ||
fn event(&self, event_action: EventAction) -> EventMessage { | ||
let event_source = EventSource::new( | ||
MayastorEnvironment::global_or_default().node_name, | ||
).with_nexus_child_data(&self.uri); | ||
EventMessage { | ||
category: EventCategory::Nexus as i32, | ||
action: event_action as i32, | ||
target: self.uuid.clone(), | ||
metadata: Some(EventMeta::from_source(event_source)), | ||
} | ||
} | ||
} | ||
|
||
// Nexus child removed event message. | ||
impl Event for RemoveChildNexusRequest { | ||
fn event(&self, event_action: EventAction) -> EventMessage { | ||
let event_source = EventSource::new( | ||
MayastorEnvironment::global_or_default().node_name, | ||
).with_nexus_child_data(&self.uri); | ||
EventMessage { | ||
category: EventCategory::Nexus as i32, | ||
action: event_action as i32, | ||
target: self.uuid.clone(), | ||
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