diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 2a8862d60c..1f573faab7 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -27,6 +27,12 @@ By [@USERNAME](https://github.com/USERNAME) in https://github.com/apollographql/ ## ❗ BREAKING ❗ +### Put `query_plan_options` in private and wrap `QueryPlanContent` in an opaque type ([PR #1486](https://github.com/apollographql/router/pull/1486)) + +`QueryPlanOptions::query_plan_options` is no longer available in public. + +By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1486 + ### Removed `delay_interval` in telemetry configuration. [PR #FIXME] It was doing nothing. @@ -56,6 +62,7 @@ It is now possible to create a subscriber and pass it explicitely to the telemet when creating it. It will then be modified to integrate the telemetry plugin's layer. By [@geal](https://github.com/geal) in https://github.com/apollographql/router/pull/1463 +>>>>>>> be6590826afb60bf3c683315c68f9ed47594a2a3 ## 🚀 Features diff --git a/apollo-router/src/query_planner/mod.rs b/apollo-router/src/query_planner/mod.rs index 1c84378436..2d2d9308d9 100644 --- a/apollo-router/src/query_planner/mod.rs +++ b/apollo-router/src/query_planner/mod.rs @@ -30,9 +30,9 @@ mod selection; /// Query planning options. #[derive(Clone, Eq, Hash, PartialEq, Debug, Default)] -pub struct QueryPlanOptions { +pub(crate) struct QueryPlanOptions { /// Enable the variable deduplication optimization on the QueryPlan - pub enable_variable_deduplication: bool, + pub(crate) enable_variable_deduplication: bool, } /// A plan for a given GraphQL query @@ -250,12 +250,6 @@ impl PlanNode { } impl QueryPlan { - /// Pass some options to the QueryPlan - pub fn with_options(mut self, options: QueryPlanOptions) -> Self { - self.options = options; - self - } - /// Execute the plan and return a [`Response`]. pub async fn execute<'a, SF>( &self, diff --git a/apollo-router/src/services/mod.rs b/apollo-router/src/services/mod.rs index 971e0391f2..9a9a07723a 100644 --- a/apollo-router/src/services/mod.rs +++ b/apollo-router/src/services/mod.rs @@ -282,13 +282,13 @@ impl RouterResponse { } assert_impl_all!(QueryPlannerRequest: Send); -/// [`Context`] and [`QueryPlanOptions`] for the request. +/// [`Context`] for the request. #[derive(Clone, Debug)] pub struct QueryPlannerRequest { pub query: String, pub operation_name: Option, /// Query plan options - pub query_plan_options: QueryPlanOptions, + pub(crate) query_plan_options: QueryPlanOptions, pub context: Context, } @@ -302,22 +302,21 @@ impl QueryPlannerRequest { pub fn new( query: String, operation_name: Option, - query_plan_options: QueryPlanOptions, context: Context, ) -> QueryPlannerRequest { Self { query, operation_name, - query_plan_options, + query_plan_options: QueryPlanOptions::default(), context, } } } assert_impl_all!(QueryPlannerResponse: Send); -/// [`Context`] and [`QueryPlan`] for the response.. +/// [`Context`] and [`QueryPlan`] for the response. pub struct QueryPlannerResponse { - pub content: QueryPlannerContent, + pub(crate) content: QueryPlannerContent, pub context: Context, } @@ -340,7 +339,7 @@ impl QueryPlannerResponse { /// /// Required parameters are required in non-testing code to create a QueryPlannerResponse. #[builder] - pub fn new(content: QueryPlannerContent, context: Context) -> QueryPlannerResponse { + pub(crate) fn new(content: QueryPlannerContent, context: Context) -> QueryPlannerResponse { Self { content, context } } @@ -364,6 +363,11 @@ impl QueryPlannerResponse { context, )) } + + /// Get a reference of the query plan + pub fn query_plan(&self) -> &QueryPlannerContent { + &self.content + } } assert_impl_all!(SubgraphRequest: Send); diff --git a/apollo-router/src/services/router_service.rs b/apollo-router/src/services/router_service.rs index ced2b966b6..ac8082a09c 100644 --- a/apollo-router/src/services/router_service.rs +++ b/apollo-router/src/services/router_service.rs @@ -38,7 +38,6 @@ use crate::plugin::DynPlugin; use crate::plugin::Plugin; use crate::query_planner::BridgeQueryPlanner; use crate::query_planner::CachingQueryPlanner; -use crate::query_planner::QueryPlanOptions; use crate::router_factory::RouterServiceFactory; use crate::services::layers::apq::APQLayer; use crate::services::layers::ensure_query_presence::EnsureQueryPresence; @@ -125,7 +124,6 @@ where .expect("the query presence was already checked by a plugin"), ) .and_operation_name(body.operation_name.clone()) - .query_plan_options(QueryPlanOptions::default()) .context(context) .build(), )