reactive_graph_dynamic_graph_api/
dynamic_graph_schema_manager.rs

1use std::sync::Arc;
2
3use async_graphql::dynamic::Schema;
4use async_graphql::dynamic::SchemaBuilder;
5use async_graphql::dynamic::SchemaError;
6use async_trait::async_trait;
7use springtime_di::injectable;
8
9use reactive_graph_lifecycle::Lifecycle;
10
11use crate::SchemaBuilderContext;
12
13#[injectable]
14#[async_trait]
15pub trait DynamicGraphSchemaManager: Send + Sync + Lifecycle {
16    /// Returns true, if the type system has been modified.
17    fn is_type_system_modified(&self) -> bool;
18
19    /// Returns a new schema builder context.
20    fn get_schema_builder_context(&self) -> SchemaBuilderContext;
21
22    /// Returns a new schema builder.
23    fn get_schema_builder(&self) -> SchemaBuilder;
24
25    /// Returns the SDL of the Dynamic Graph Schema.
26    async fn create_dynamic_schema(&self) -> Result<Schema, SchemaError>;
27
28    /// Returns the SDL of the Dynamic Graph Schema.
29    fn create_dynamic_schema_sync(&self) -> Result<Schema, SchemaError>;
30
31    /// Regenerates the Dynamic Graph Schema.
32    async fn regenerate_dynamic_schema(&self) -> Result<(), SchemaError>;
33
34    /// Regenerates the Dynamic Graph Schema if and only if the type system has been modified.
35    async fn regenerate_dynamic_schema_if_modified(&self) -> Result<(), SchemaError>;
36
37    /// Returns the Dynamic Graph Schema.
38    async fn get_dynamic_schema(&self) -> Result<Arc<Schema>, SchemaError>;
39}