shared/models/server/
events.rs1use crate::models::EventEmittingModel;
2use std::sync::LazyLock;
3
4#[non_exhaustive]
5pub enum ServerEvent {
6 TransferStarted {
8 server: Box<super::Server>,
9 destination_node: Box<crate::models::node::Node>,
10 destination_allocation: Option<uuid::Uuid>,
11 destination_allocations: Vec<uuid::Uuid>,
12 },
13 TransferCompleted {
15 server: Box<super::Server>,
16 destination_node: Box<crate::models::node::Node>,
17 successful: bool,
18 },
19 InstallStarted {
21 server: Box<super::Server>,
22 installation_script: Box<wings_api::InstallationScript>,
23 },
24 InstallCompleted {
26 server: Box<super::Server>,
27 successful: bool,
28 },
29 StateReset { server: Box<super::Server> },
32}
33
34#[async_trait::async_trait]
35impl EventEmittingModel for super::Server {
36 type Event = ServerEvent;
37
38 fn get_event_emitter() -> &'static crate::events::EventEmitter<Self::Event> {
39 static EVENT_EMITTER: LazyLock<crate::events::EventEmitter<ServerEvent>> =
40 LazyLock::new(crate::events::EventEmitter::default);
41
42 &EVENT_EMITTER
43 }
44}