Skip to content

Commit 94bbf14

Browse files
authored
Delete old service context (#654)
1 parent a6ccb09 commit 94bbf14

7 files changed

Lines changed: 0 additions & 126 deletions

File tree

lib/src/main/java/graphql/nadel/NextgenEngine.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ internal class NextgenEngine(
414414
executionId = executionInput.executionId ?: executionIdProvider.provide(executionInput),
415415
variables = compileResult.variables,
416416
operationDefinition = compileResult.document.definitions.singleOfType(),
417-
serviceContext = executionContext.getContextForService(service).await(),
418417
serviceExecutionContext = serviceExecutionContext,
419418
hydrationDetails = executionHydrationDetails,
420419
// Prefer non __typename field first, otherwise we just get first

lib/src/main/java/graphql/nadel/ServiceExecutionParameters.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@ class ServiceExecutionParameters internal constructor(
1515
val operationDefinition: OperationDefinition,
1616
val executionId: ExecutionId,
1717
val serviceExecutionContext: NadelServiceExecutionContext,
18-
private val serviceContext: Any?,
1918
/**
2019
* @return details abut this service hydration or null if it's not a hydration call
2120
*/
2221
val hydrationDetails: ServiceExecutionHydrationDetails?,
2322
val executableNormalizedField: ExecutableNormalizedField,
2423
) {
25-
@Deprecated("Use serviceExecutionContext instead")
26-
fun <T> getServiceContext(): T? {
27-
@Suppress("UNCHECKED_CAST") // Trust caller
28-
return serviceContext as T?
29-
}
30-
3124
val isHydrationCall: Boolean
3225
get() = hydrationDetails != null
3326
}

lib/src/main/java/graphql/nadel/engine/NadelExecutionContext.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import graphql.ExecutionInput
44
import graphql.GraphQLContext
55
import graphql.execution.instrumentation.InstrumentationState
66
import graphql.nadel.NadelExecutionHints
7-
import graphql.nadel.Service
87
import graphql.nadel.ServiceExecutionHydrationDetails
98
import graphql.nadel.engine.instrumentation.NadelInstrumentationTimer
10-
import graphql.nadel.hooks.CreateServiceContextParams
119
import graphql.nadel.hooks.NadelExecutionHooks
1210
import graphql.nadel.result.NadelResultTracker
1311
import graphql.normalized.ExecutableNormalizedOperation
@@ -43,16 +41,4 @@ data class NadelExecutionContext internal constructor(
4341
get() {
4442
return executionInput.graphQLContext!!
4543
}
46-
47-
/**
48-
* Get the service context for a given service
49-
*/
50-
@Deprecated("Replaced with NadelServiceExecutionContext")
51-
fun getContextForService(service: Service): CompletableFuture<Any?> {
52-
return serviceContexts.getOrPut(service.name) {
53-
hooks.createServiceContext(
54-
CreateServiceContextParams(service)
55-
)
56-
}
57-
}
5844
}

lib/src/main/java/graphql/nadel/hooks/CreateServiceContextParams.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/src/main/java/graphql/nadel/hooks/NadelExecutionHooks.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,25 @@
11
package graphql.nadel.hooks
22

3-
import graphql.language.ScalarValue
43
import graphql.nadel.Service
54
import graphql.nadel.ServiceExecutionHydrationDetails
65
import graphql.nadel.engine.NadelExecutionContext
76
import graphql.nadel.engine.NadelServiceExecutionContext
87
import graphql.nadel.engine.blueprint.NadelBatchHydrationFieldInstruction
98
import graphql.nadel.engine.blueprint.NadelGenericHydrationInstruction
109
import graphql.nadel.engine.blueprint.NadelOverallExecutionBlueprint
11-
import graphql.nadel.engine.transform.NadelTransform
1210
import graphql.nadel.engine.transform.artificial.NadelAliasHelper
1311
import graphql.nadel.engine.transform.partition.NadelFieldPartitionContext
1412
import graphql.nadel.engine.transform.partition.NadelPartitionKeyExtractor
1513
import graphql.nadel.engine.transform.partition.NadelPartitionTransformHook
1614
import graphql.nadel.engine.transform.result.json.JsonNode
1715
import graphql.normalized.ExecutableNormalizedField
18-
import graphql.schema.GraphQLInputValueDefinition
1916
import kotlinx.coroutines.future.await
2017
import java.util.concurrent.CompletableFuture
2118

2219
/**
2320
* These hooks allow you to change the way service execution happens
2421
*/
2522
interface NadelExecutionHooks {
26-
/**
27-
* Creates one context per [Service] per request.
28-
*
29-
* So even if a request has multiple calls to one [Service] we will reuse the same context.
30-
*
31-
* This is deprecated now, please use [createServiceExecutionContext] instead.
32-
*
33-
* @param params the parameters to this call
34-
* @return an async context object of your choosing
35-
*/
36-
@Deprecated("Use createServiceExecutionContext instead")
37-
fun createServiceContext(params: CreateServiceContextParams): CompletableFuture<Any?> {
38-
return CompletableFuture.completedFuture(null)
39-
}
40-
4123
fun createServiceExecutionContext(params: NadelCreateServiceExecutionContextParams): CompletableFuture<NadelServiceExecutionContext> {
4224
return CompletableFuture.completedFuture(NadelServiceExecutionContext.None)
4325
}

test/src/test/kotlin/graphql/nadel/tests/hooks/service-context-is-being-set.kt

Lines changed: 0 additions & 36 deletions
This file was deleted.

test/src/test/resources/fixtures/basic/service-context-is-being-set.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)