reactive_graph_runtime_graphql_schema/mutation/
mod.rs

1use std::sync::Arc;
2
3use async_graphql::Context;
4use async_graphql::Object;
5use async_graphql::Result;
6
7use reactive_graph_runtime_service_api::ShutdownManager;
8
9use crate::mutation::command::MutationCommands;
10use crate::mutation::remotes::MutationRemotes;
11
12pub mod command;
13pub mod remotes;
14
15pub struct RuntimeMutation;
16
17/// Mutations for the type system, the instances and the flows.
18#[Object(name = "Mutation")]
19impl RuntimeMutation {
20    async fn commands(&self) -> MutationCommands {
21        MutationCommands
22    }
23
24    async fn remotes(&self) -> MutationRemotes {
25        MutationRemotes
26    }
27
28    async fn shutdown(&self, context: &Context<'_>) -> Result<bool> {
29        let shutdown_manager = context.data::<Arc<dyn ShutdownManager + Send + Sync>>()?;
30        shutdown_manager.do_shutdown();
31        Ok(true)
32    }
33}