Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete old service context #654

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/src/main/java/graphql/nadel/NextgenEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ internal class NextgenEngine(
executionId = executionInput.executionId ?: executionIdProvider.provide(executionInput),
variables = compileResult.variables,
operationDefinition = compileResult.document.definitions.singleOfType(),
serviceContext = executionContext.getContextForService(service).await(),
serviceExecutionContext = serviceExecutionContext,
hydrationDetails = executionHydrationDetails,
// Prefer non __typename field first, otherwise we just get first
Expand Down
7 changes: 0 additions & 7 deletions lib/src/main/java/graphql/nadel/ServiceExecutionParameters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@ class ServiceExecutionParameters internal constructor(
val operationDefinition: OperationDefinition,
val executionId: ExecutionId,
val serviceExecutionContext: NadelServiceExecutionContext,
private val serviceContext: Any?,
/**
* @return details abut this service hydration or null if it's not a hydration call
*/
val hydrationDetails: ServiceExecutionHydrationDetails?,
val executableNormalizedField: ExecutableNormalizedField,
) {
@Deprecated("Use serviceExecutionContext instead")
fun <T> getServiceContext(): T? {
@Suppress("UNCHECKED_CAST") // Trust caller
return serviceContext as T?
}

val isHydrationCall: Boolean
get() = hydrationDetails != null
}
14 changes: 0 additions & 14 deletions lib/src/main/java/graphql/nadel/engine/NadelExecutionContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import graphql.ExecutionInput
import graphql.GraphQLContext
import graphql.execution.instrumentation.InstrumentationState
import graphql.nadel.NadelExecutionHints
import graphql.nadel.Service
import graphql.nadel.ServiceExecutionHydrationDetails
import graphql.nadel.engine.instrumentation.NadelInstrumentationTimer
import graphql.nadel.hooks.CreateServiceContextParams
import graphql.nadel.hooks.NadelExecutionHooks
import graphql.nadel.result.NadelResultTracker
import graphql.normalized.ExecutableNormalizedOperation
Expand Down Expand Up @@ -43,16 +41,4 @@ data class NadelExecutionContext internal constructor(
get() {
return executionInput.graphQLContext!!
}

/**
* Get the service context for a given service
*/
@Deprecated("Replaced with NadelServiceExecutionContext")
fun getContextForService(service: Service): CompletableFuture<Any?> {
return serviceContexts.getOrPut(service.name) {
hooks.createServiceContext(
CreateServiceContextParams(service)
)
}
}
}

This file was deleted.

18 changes: 0 additions & 18 deletions lib/src/main/java/graphql/nadel/hooks/NadelExecutionHooks.kt
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
package graphql.nadel.hooks

import graphql.language.ScalarValue
import graphql.nadel.Service
import graphql.nadel.ServiceExecutionHydrationDetails
import graphql.nadel.engine.NadelExecutionContext
import graphql.nadel.engine.NadelServiceExecutionContext
import graphql.nadel.engine.blueprint.NadelBatchHydrationFieldInstruction
import graphql.nadel.engine.blueprint.NadelGenericHydrationInstruction
import graphql.nadel.engine.blueprint.NadelOverallExecutionBlueprint
import graphql.nadel.engine.transform.NadelTransform
import graphql.nadel.engine.transform.artificial.NadelAliasHelper
import graphql.nadel.engine.transform.partition.NadelFieldPartitionContext
import graphql.nadel.engine.transform.partition.NadelPartitionKeyExtractor
import graphql.nadel.engine.transform.partition.NadelPartitionTransformHook
import graphql.nadel.engine.transform.result.json.JsonNode
import graphql.normalized.ExecutableNormalizedField
import graphql.schema.GraphQLInputValueDefinition
import kotlinx.coroutines.future.await
import java.util.concurrent.CompletableFuture

/**
* These hooks allow you to change the way service execution happens
*/
interface NadelExecutionHooks {
/**
* Creates one context per [Service] per request.
*
* So even if a request has multiple calls to one [Service] we will reuse the same context.
*
* This is deprecated now, please use [createServiceExecutionContext] instead.
*
* @param params the parameters to this call
* @return an async context object of your choosing
*/
@Deprecated("Use createServiceExecutionContext instead")
fun createServiceContext(params: CreateServiceContextParams): CompletableFuture<Any?> {
return CompletableFuture.completedFuture(null)
}

fun createServiceExecutionContext(params: NadelCreateServiceExecutionContextParams): CompletableFuture<NadelServiceExecutionContext> {
return CompletableFuture.completedFuture(NadelServiceExecutionContext.None)
}
Expand Down

This file was deleted.

This file was deleted.

Loading