From 65e77295452716fee3b79fc9dc24a06f124fd22a Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Tue, 13 Feb 2024 14:54:28 +0100 Subject: [PATCH] Rename `UnkeyedContext` to `Context` (#220) --- .../java/my/restate/sdk/examples/Loan.java | 4 ++-- .../dev/restate/sdk/protocgen/RestateGen.java | 2 +- .../src/main/resources/javaStub.mustache | 16 +++++++------- .../src/main/resources/ktStub.mustache | 12 +++++----- .../resources/templates/RestateClient.hbs | 22 +++++++++---------- .../main/kotlin/dev/restate/sdk/kotlin/api.kt | 13 +++++------ .../restate/sdk/kotlin/RestateCodegenTest.kt | 10 ++++----- .../sdk/{UnkeyedContext.java => Context.java} | 6 ++--- .../dev/restate/sdk/GrpcChannelAdapter.java | 4 ++-- .../java/dev/restate/sdk/KeyedContext.java | 8 +++---- .../dev/restate/sdk/RestateCodegenTest.java | 10 ++++----- .../sdk/workflow/WorkflowSharedContext.java | 4 ++-- .../workflow/impl/WorkflowCodegenUtil.java | 16 +++++++------- .../workflow/impl/WorkflowServicesBundle.java | 11 +++++----- 14 files changed, 68 insertions(+), 70 deletions(-) rename sdk-api/src/main/java/dev/restate/sdk/{UnkeyedContext.java => Context.java} (98%) diff --git a/examples/src/main/java/my/restate/sdk/examples/Loan.java b/examples/src/main/java/my/restate/sdk/examples/Loan.java index a65ef61c..07ff2ff1 100644 --- a/examples/src/main/java/my/restate/sdk/examples/Loan.java +++ b/examples/src/main/java/my/restate/sdk/examples/Loan.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.annotation.Service; import dev.restate.sdk.annotation.ServiceType; import dev.restate.sdk.annotation.Shared; @@ -221,7 +221,7 @@ private static void askHumanApproval(String workflowKey) throws InterruptedExcep private static class MockBank extends BankRestate.BankRestateImplBase { @Override - public TransferResult transfer(UnkeyedContext context, TransferRequest request) + public TransferResult transfer(Context context, TransferRequest request) throws TerminalException { boolean shouldAccept = context.random().nextInt(3) != 1; if (shouldAccept) { diff --git a/protoc-gen-restate/src/main/java/dev/restate/sdk/protocgen/RestateGen.java b/protoc-gen-restate/src/main/java/dev/restate/sdk/protocgen/RestateGen.java index fdee4873..508fb338 100644 --- a/protoc-gen-restate/src/main/java/dev/restate/sdk/protocgen/RestateGen.java +++ b/protoc-gen-restate/src/main/java/dev/restate/sdk/protocgen/RestateGen.java @@ -124,7 +124,7 @@ private ServiceContext buildServiceContext( // Resolve context type serviceContext.contextType = serviceProto.getOptions().getExtension(Ext.serviceType) == ServiceType.UNKEYED - ? "UnkeyedContext" + ? "Context" : "KeyedContext"; // Resolve javadoc diff --git a/protoc-gen-restate/src/main/resources/javaStub.mustache b/protoc-gen-restate/src/main/resources/javaStub.mustache index f5ca127e..d2da2251 100644 --- a/protoc-gen-restate/src/main/resources/javaStub.mustache +++ b/protoc-gen-restate/src/main/resources/javaStub.mustache @@ -2,7 +2,7 @@ package {{packageName}}; {{/packageName}} -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.KeyedContext; import dev.restate.sdk.Awaitable; import dev.restate.sdk.common.syscalls.Syscalls; @@ -18,15 +18,15 @@ public class {{className}} { /** * Create a new client from the given {@link KeyedContext}. */ - public static {{serviceName}}RestateClient newClient(UnkeyedContext ctx) { + public static {{serviceName}}RestateClient newClient(Context ctx) { return new {{serviceName}}RestateClient(ctx); } {{{apidoc}}} public static final class {{serviceName}}RestateClient { - private final UnkeyedContext ctx; + private final Context ctx; - {{serviceName}}RestateClient(UnkeyedContext ctx) { + {{serviceName}}RestateClient(Context ctx) { this.ctx = ctx; } @@ -51,9 +51,9 @@ public class {{className}} { } public static final class {{serviceName}}RestateOneWayClient { - private final UnkeyedContext ctx; + private final Context ctx; - {{serviceName}}RestateOneWayClient(UnkeyedContext ctx) { + {{serviceName}}RestateOneWayClient(Context ctx) { this.ctx = ctx; } @@ -68,10 +68,10 @@ public class {{className}} { } public static final class {{serviceName}}RestateDelayedClient { - private final UnkeyedContext ctx; + private final Context ctx; private final Duration delay; - {{serviceName}}RestateDelayedClient(UnkeyedContext ctx, Duration delay) { + {{serviceName}}RestateDelayedClient(Context ctx, Duration delay) { this.ctx = ctx; this.delay = delay; } diff --git a/protoc-gen-restate/src/main/resources/ktStub.mustache b/protoc-gen-restate/src/main/resources/ktStub.mustache index b475fa05..4080839a 100644 --- a/protoc-gen-restate/src/main/resources/ktStub.mustache +++ b/protoc-gen-restate/src/main/resources/ktStub.mustache @@ -2,7 +2,7 @@ package {{packageName}}; {{/packageName}} -import dev.restate.sdk.kotlin.UnkeyedContext; +import dev.restate.sdk.kotlin.Context; import dev.restate.sdk.kotlin.KeyedContext; import dev.restate.sdk.kotlin.Awaitable; import dev.restate.sdk.kotlin.RestateKtService; @@ -18,14 +18,14 @@ import kotlin.time.Duration public object {{className}} { /** - * Create a new client from the given [UnkeyedContext]. + * Create a new client from the given [Context]. */ - fun newClient(ctx: UnkeyedContext): {{serviceName}}RestateKtClient { + fun newClient(ctx: Context): {{serviceName}}RestateKtClient { return {{serviceName}}RestateKtClient(ctx); } {{{javadoc}}} - public class {{serviceName}}RestateKtClient(private val ctx: UnkeyedContext) { + public class {{serviceName}}RestateKtClient(private val ctx: Context) { // Create a variant of this client to execute oneWay calls. public fun oneWay(): {{serviceName}}RestateKtOneWayClient { return {{serviceName}}RestateKtOneWayClient(ctx); @@ -46,7 +46,7 @@ public object {{className}} { {{/methods}} } - public class {{serviceName}}RestateKtOneWayClient(private val ctx: UnkeyedContext) { + public class {{serviceName}}RestateKtOneWayClient(private val ctx: Context) { {{#methods}} {{#deprecated}}@Deprecated{{/deprecated}} {{{javadoc}}} @@ -57,7 +57,7 @@ public object {{className}} { {{/methods}} } - public class {{serviceName}}RestateKtDelayedClient(private val ctx: UnkeyedContext, private val delay: Duration) { + public class {{serviceName}}RestateKtDelayedClient(private val ctx: Context, private val delay: Duration) { {{#methods}} {{#deprecated}}@Deprecated{{/deprecated}} {{{javadoc}}} diff --git a/sdk-api-gen/src/main/resources/templates/RestateClient.hbs b/sdk-api-gen/src/main/resources/templates/RestateClient.hbs index 8bf3dc57..5a1d3a8b 100644 --- a/sdk-api-gen/src/main/resources/templates/RestateClient.hbs +++ b/sdk-api-gen/src/main/resources/templates/RestateClient.hbs @@ -3,7 +3,7 @@ import dev.restate.sdk.common.StateKey; import dev.restate.sdk.common.Serde; import dev.restate.sdk.Awaitable; -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.workflow.impl.WorkflowCodegenUtil; import java.util.Optional; import java.time.Duration; @@ -21,36 +21,36 @@ public class {{className}}RestateClient { {{^outputEmpty}}private static final Serde<{{{outputFqcn}}}> {{outputSerdeFieldName}} = {{{outputSerdeDecl}}};{{/outputEmpty}} {{/methods}} - private final UnkeyedContext restateContext; + private final Context ctx; private final String workflowKey; - public {{className}}RestateClient(UnkeyedContext restateContext, String workflowKey) { - this.restateContext = restateContext; + public {{className}}RestateClient(Context ctx, String workflowKey) { + this.ctx = ctx; this.workflowKey = workflowKey; } {{#methods}}{{#if isWorkflow}} public Awaitable submit({{^inputEmpty}}{{{inputFqcn}}} req{{/inputEmpty}}) { - return WorkflowCodegenUtil.RestateClient.submit(restateContext, WF_SUBMIT_METHOD_DESC, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); + return WorkflowCodegenUtil.RestateClient.submit(ctx, WF_SUBMIT_METHOD_DESC, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); } public Awaitable isCompleted() { - return WorkflowCodegenUtil.RestateClient.isCompleted(restateContext, WF_MANAGER_GET_OUTPUT_METHOD_DESC, workflowKey); + return WorkflowCodegenUtil.RestateClient.isCompleted(ctx, WF_MANAGER_GET_OUTPUT_METHOD_DESC, workflowKey); } {{^outputEmpty}} public Awaitable> getOutput() { - return WorkflowCodegenUtil.RestateClient.getOutput(restateContext, WF_MANAGER_GET_OUTPUT_METHOD_DESC, workflowKey, {{outputSerdeFieldName}}); + return WorkflowCodegenUtil.RestateClient.getOutput(ctx, WF_MANAGER_GET_OUTPUT_METHOD_DESC, workflowKey, {{outputSerdeFieldName}}); }{{/outputEmpty}} {{/if}}{{/methods}} public Awaitable> getState(StateKey key) { - return WorkflowCodegenUtil.RestateClient.getState(restateContext, WF_MANAGER_GET_STATE_METHOD_DESC, workflowKey, key); + return WorkflowCodegenUtil.RestateClient.getState(ctx, WF_MANAGER_GET_STATE_METHOD_DESC, workflowKey, key); } {{#methods}}{{#if isShared}} public {{#if outputEmpty}}Awaitable{{else}}Awaitable<{{{outputFqcn}}}>{{/if}} {{name}}({{^inputEmpty}}{{{inputFqcn}}} req{{/inputEmpty}}) { - Awaitable response = WorkflowCodegenUtil.RestateClient.invokeShared(restateContext, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); + Awaitable response = WorkflowCodegenUtil.RestateClient.invokeShared(ctx, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); {{#if outputEmpty}} return response.map(v -> { return null; }); {{else}} @@ -71,7 +71,7 @@ public class {{className}}RestateClient { {{#methods}}{{#if isShared}} public void {{name}}({{^inputEmpty}}{{{inputFqcn}}} req{{/inputEmpty}}) { - WorkflowCodegenUtil.RestateClient.invokeSharedOneWay(restateContext, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); + WorkflowCodegenUtil.RestateClient.invokeSharedOneWay(ctx, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}); } {{/if}}{{/methods}} @@ -87,7 +87,7 @@ public class {{className}}RestateClient { {{#methods}}{{#if isShared}} public void {{name}}({{^inputEmpty}}{{{inputFqcn}}} req{{/inputEmpty}}) { - WorkflowCodegenUtil.RestateClient.invokeSharedDelayed(restateContext, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}, delay); + WorkflowCodegenUtil.RestateClient.invokeSharedDelayed(ctx, {{descFieldName}}, workflowKey, {{#if inputEmpty}}null{{else}}WorkflowCodegenUtil.tToValue({{inputSerdeFieldName}}, req){{/if}}, delay); } {{/if}}{{/methods}} diff --git a/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt index 61e9f98e..83326751 100644 --- a/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt @@ -32,7 +32,7 @@ import kotlin.time.Duration * NOTE: This interface MUST NOT be accessed concurrently since it can lead to different orderings * of user actions, corrupting the execution of the invocation. */ -sealed interface UnkeyedContext { +sealed interface Context { /** * Causes the current execution of the function invocation to sleep for the given duration. @@ -191,26 +191,25 @@ sealed interface UnkeyedContext { companion object { /** - * Create a [UnkeyedContext]. This will look up the thread-local/async-context storage for the + * Create a [Context]. This will look up the thread-local/async-context storage for the * underlying context implementation, so make sure to call it always from the same context where * the service is executed. */ - fun current(): UnkeyedContext { + fun current(): Context { return fromSyscalls(Syscalls.current()) } /** Build a context from the underlying [Syscalls] object. */ - fun fromSyscalls(syscalls: Syscalls): UnkeyedContext { + fun fromSyscalls(syscalls: Syscalls): Context { return ContextImpl(syscalls) } } } /** - * This interface extends [UnkeyedContext] adding access to the service instance key-value state - * storage. + * This interface extends [Context] adding access to the service instance key-value state storage. */ -sealed interface KeyedContext : UnkeyedContext { +sealed interface KeyedContext : Context { /** * Gets the state stored under key, deserializing the raw value using the registered diff --git a/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/RestateCodegenTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/RestateCodegenTest.kt index 0d2b8793..96a5a2af 100644 --- a/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/RestateCodegenTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/RestateCodegenTest.kt @@ -30,27 +30,27 @@ class RestateCodegenTest : RestateCodegenTestSuite() { } private class Codegen : CodegenRestateKtImplBase() { - override suspend fun emptyInput(context: UnkeyedContext): MyMessage { + override suspend fun emptyInput(context: Context): MyMessage { val client = CodegenRestateKt.newClient(context) return client.emptyInput().await() } - override suspend fun emptyOutput(context: UnkeyedContext, request: MyMessage) { + override suspend fun emptyOutput(context: Context, request: MyMessage) { val client = CodegenRestateKt.newClient(context) client.emptyOutput(request).await() } - override suspend fun emptyInputOutput(context: UnkeyedContext) { + override suspend fun emptyInputOutput(context: Context) { val client = CodegenRestateKt.newClient(context) client.emptyInputOutput().await() } - override suspend fun oneWay(context: UnkeyedContext, request: MyMessage): MyMessage { + override suspend fun oneWay(context: Context, request: MyMessage): MyMessage { val client = CodegenRestateKt.newClient(context) return client._oneWay(request).await() } - override suspend fun delayed(context: UnkeyedContext, request: MyMessage): MyMessage { + override suspend fun delayed(context: Context, request: MyMessage): MyMessage { val client = CodegenRestateKt.newClient(context) return client._delayed(request).await() } diff --git a/sdk-api/src/main/java/dev/restate/sdk/UnkeyedContext.java b/sdk-api/src/main/java/dev/restate/sdk/Context.java similarity index 98% rename from sdk-api/src/main/java/dev/restate/sdk/UnkeyedContext.java rename to sdk-api/src/main/java/dev/restate/sdk/Context.java index eda7d9e1..b17b43a6 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/UnkeyedContext.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Context.java @@ -30,7 +30,7 @@ * orderings of user actions, corrupting the execution of the invocation. */ @NotThreadSafe -public interface UnkeyedContext { +public interface Context { /** * Invoke another Restate service method. @@ -185,12 +185,12 @@ default void sideEffect(ThrowingRunnable runnable) throws TerminalException { * underlying context implementation, so make sure to call it always from the same context where * the service is executed. */ - static UnkeyedContext current() { + static Context current() { return fromSyscalls(Syscalls.current()); } /** Build a RestateContext from the underlying {@link Syscalls} object. */ - static UnkeyedContext fromSyscalls(Syscalls syscalls) { + static Context fromSyscalls(Syscalls syscalls) { return new ContextImpl(syscalls); } } diff --git a/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java b/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java index c05b0fa7..d7e7b85d 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java +++ b/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java @@ -18,9 +18,9 @@ *

Keep in mind that this channel should be used only with generated blocking stubs. */ public class GrpcChannelAdapter extends Channel { - private final UnkeyedContext ctx; + private final Context ctx; - GrpcChannelAdapter(UnkeyedContext ctx) { + GrpcChannelAdapter(Context ctx) { this.ctx = ctx; } diff --git a/sdk-api/src/main/java/dev/restate/sdk/KeyedContext.java b/sdk-api/src/main/java/dev/restate/sdk/KeyedContext.java index 92862947..48df23d8 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/KeyedContext.java +++ b/sdk-api/src/main/java/dev/restate/sdk/KeyedContext.java @@ -16,13 +16,13 @@ import javax.annotation.concurrent.NotThreadSafe; /** - * This interface extends {@link UnkeyedContext} adding access to the service instance key-value - * state storage + * This interface extends {@link Context} adding access to the service instance key-value state + * storage * - * @see UnkeyedContext + * @see Context */ @NotThreadSafe -public interface KeyedContext extends UnkeyedContext { +public interface KeyedContext extends Context { /** * Gets the state stored under key, deserializing the raw value using the {@link Serde} in the diff --git a/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java b/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java index 3e2c4c45..568f8482 100644 --- a/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java @@ -35,31 +35,31 @@ protected BindableService greeterWithRestateClientAndServerCodegen() { private static class Codegen extends CodegenRestate.CodegenRestateImplBase { @Override - public MyMessage emptyInput(UnkeyedContext context) { + public MyMessage emptyInput(Context context) { CodegenRestate.CodegenRestateClient client = CodegenRestate.newClient(context); return client.emptyInput().await(); } @Override - public void emptyOutput(UnkeyedContext context, MyMessage request) { + public void emptyOutput(Context context, MyMessage request) { CodegenRestate.CodegenRestateClient client = CodegenRestate.newClient(context); client.emptyOutput(request).await(); } @Override - public void emptyInputOutput(UnkeyedContext context) { + public void emptyInputOutput(Context context) { CodegenRestate.CodegenRestateClient client = CodegenRestate.newClient(context); client.emptyInputOutput().await(); } @Override - public MyMessage oneWay(UnkeyedContext context, MyMessage request) { + public MyMessage oneWay(Context context, MyMessage request) { CodegenRestate.CodegenRestateClient client = CodegenRestate.newClient(context); return client._oneWay(request).await(); } @Override - public MyMessage delayed(UnkeyedContext context, MyMessage request) { + public MyMessage delayed(Context context, MyMessage request) { CodegenRestate.CodegenRestateClient client = CodegenRestate.newClient(context); return client._delayed(request).await(); } diff --git a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/WorkflowSharedContext.java b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/WorkflowSharedContext.java index 2f961218..df17fe30 100644 --- a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/WorkflowSharedContext.java +++ b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/WorkflowSharedContext.java @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.workflow; -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.common.StateKey; import java.util.Optional; -public interface WorkflowSharedContext extends UnkeyedContext { +public interface WorkflowSharedContext extends Context { String workflowKey(); diff --git a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowCodegenUtil.java b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowCodegenUtil.java index e606a20c..b23d57bc 100644 --- a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowCodegenUtil.java +++ b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowCodegenUtil.java @@ -16,7 +16,7 @@ import com.google.protobuf.util.JsonFormat; import dev.restate.generated.IngressGrpc; import dev.restate.sdk.Awaitable; -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.common.Serde; import dev.restate.sdk.common.StateKey; import dev.restate.sdk.common.TerminalException; @@ -63,7 +63,7 @@ public static class RestateClient { private RestateClient() {} public static Awaitable submit( - UnkeyedContext ctx, + Context ctx, MethodDescriptor submitMethodDesc, String workflowKey, @Nullable Value payload) { @@ -75,7 +75,7 @@ public static Awaitable submit( } public static Awaitable> getOutput( - UnkeyedContext ctx, + Context ctx, MethodDescriptor getOutputMethodDesc, String workflowKey, Serde serde) { @@ -95,7 +95,7 @@ public static Awaitable> getOutput( } public static Awaitable isCompleted( - UnkeyedContext ctx, + Context ctx, MethodDescriptor getOutputMethodDesc, String workflowKey) { return ctx.call(getOutputMethodDesc, OutputRequest.newBuilder().setKey(workflowKey).build()) @@ -111,7 +111,7 @@ public static Awaitable isCompleted( } public static Awaitable invokeShared( - UnkeyedContext ctx, + Context ctx, MethodDescriptor invokeMethodDesc, String workflowKey, @Nullable Value payload) { @@ -124,7 +124,7 @@ public static Awaitable invokeShared( } public static void invokeSharedOneWay( - UnkeyedContext ctx, + Context ctx, MethodDescriptor invokeMethodDesc, String workflowKey, @Nullable Value payload) { @@ -137,7 +137,7 @@ public static void invokeSharedOneWay( } public static void invokeSharedDelayed( - UnkeyedContext ctx, + Context ctx, MethodDescriptor invokeMethodDesc, String workflowKey, @Nullable Value payload, @@ -151,7 +151,7 @@ public static void invokeSharedDelayed( } public static Awaitable> getState( - UnkeyedContext ctx, + Context ctx, MethodDescriptor getStateMethodDesc, String workflowKey, StateKey key) { diff --git a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowServicesBundle.java b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowServicesBundle.java index 10f8e2d9..0031d8cd 100644 --- a/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowServicesBundle.java +++ b/sdk-workflow-api/src/main/java/dev/restate/sdk/workflow/impl/WorkflowServicesBundle.java @@ -10,7 +10,7 @@ import static dev.restate.sdk.workflow.impl.DescriptorUtils.toMethodName; -import dev.restate.sdk.UnkeyedContext; +import dev.restate.sdk.Context; import dev.restate.sdk.common.BlockingService; import dev.restate.sdk.common.Serde; import dev.restate.sdk.common.ServicesBundle; @@ -117,20 +117,19 @@ public WorkflowServicesBundle build() { public static class Method { private final MethodSignature methodSignature; - private final BiFunction runner; + private final BiFunction runner; Method( - MethodSignature methodSignature, - BiFunction runner) { + MethodSignature methodSignature, BiFunction runner) { this.methodSignature = methodSignature; - this.runner = (BiFunction) runner; + this.runner = (BiFunction) runner; } public MethodSignature getMethodSignature() { return methodSignature; } - public RES run(UnkeyedContext ctx, REQ req) { + public RES run(Context ctx, REQ req) { return runner.apply(ctx, req); } }