diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java b/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java index bbe8d1fe..32cd3b57 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java @@ -11,9 +11,9 @@ import dev.restate.sdk.common.HandlerType; import dev.restate.sdk.common.ServiceType; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; import dev.restate.sdk.core.manifest.Handler; +import dev.restate.sdk.core.manifest.Service; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -28,19 +28,19 @@ public DeploymentManifest( .withMinProtocolVersion(1) .withMaxProtocolVersion(1) .withProtocolMode(protocolMode) - .withComponents( + .withServices( components .map( svc -> - new Component() - .withFullyQualifiedComponentName(svc.getServiceName()) - .withComponentType(convertServiceType(svc.getServiceType())) + new Service() + .withName(svc.getServiceName()) + .withTy(convertServiceType(svc.getServiceType())) .withHandlers( svc.getHandlers().stream() .map( method -> new Handler() - .withHandlerType( + .withTy( convertHandlerType(method.getHandlerType())) .withName(method.getName())) .collect(Collectors.toList()))) @@ -51,23 +51,23 @@ public DeploymentManifestSchema manifest() { return this.manifest; } - private static Component.ComponentType convertServiceType(ServiceType serviceType) { + private static Service.Ty convertServiceType(ServiceType serviceType) { switch (serviceType) { case WORKFLOW: case SERVICE: - return Component.ComponentType.SERVICE; + return Service.Ty.SERVICE; case VIRTUAL_OBJECT: - return Component.ComponentType.VIRTUAL_OBJECT; + return Service.Ty.VIRTUAL_OBJECT; } throw new IllegalStateException(); } - private static Handler.HandlerType convertHandlerType(HandlerType handlerType) { + private static Handler.Ty convertHandlerType(HandlerType handlerType) { switch (handlerType) { case EXCLUSIVE: - return Handler.HandlerType.EXCLUSIVE; + return Handler.Ty.EXCLUSIVE; case SHARED: - return Handler.HandlerType.SHARED; + return Handler.Ty.SHARED; } throw new IllegalStateException(); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java index 2e7f7706..ad98d6e9 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java @@ -375,7 +375,7 @@ public Result parseCompletionResult(CompletionMessage actual) { } } - static final class InvokeEntry extends CompletableJournalEntry { + static final class InvokeEntry extends CompletableJournalEntry { private final Function> valueParser; @@ -384,43 +384,42 @@ static final class InvokeEntry extends CompletableJournalEntry parseEntryResult(InvokeEntryMessage actual) { + public Result parseEntryResult(CallEntryMessage actual) { if (actual.hasValue()) { return valueParser.apply(actual.getValue()); } @@ -439,30 +438,30 @@ public Result parseCompletionResult(CompletionMessage actual) { } } - static final class BackgroundInvokeEntry extends JournalEntry { + static final class BackgroundInvokeEntry extends JournalEntry { static final BackgroundInvokeEntry INSTANCE = new BackgroundInvokeEntry(); private BackgroundInvokeEntry() {} @Override - public void trace(BackgroundInvokeEntryMessage expected, Span span) { + public void trace(OneWayCallEntryMessage expected, Span span) { span.addEvent( "BackgroundInvoke", Attributes.of( Tracing.RESTATE_COORDINATION_CALL_SERVICE, expected.getServiceName(), Tracing.RESTATE_COORDINATION_CALL_METHOD, - expected.getMethodName())); + expected.getHandlerName())); } @Override - String getName(BackgroundInvokeEntryMessage expected) { + String getName(OneWayCallEntryMessage expected) { return expected.getName(); } @Override - void checkEntryHeader(BackgroundInvokeEntryMessage expected, MessageLite actual) + void checkEntryHeader(OneWayCallEntryMessage expected, MessageLite actual) throws ProtocolException { Util.assertEntryEquals(expected, actual); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java index d912395c..f5da7783 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java @@ -404,7 +404,7 @@ void processJournalEntry( void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) { checkInsideSideEffectGuard(); - this.nextJournalEntry(name, MessageType.SideEffectEntryMessage); + this.nextJournalEntry(name, MessageType.RunEntryMessage); if (this.invocationState == InvocationState.CLOSED) { callback.onCancel(AbortedExecutionException.INSTANCE); @@ -412,10 +412,10 @@ void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) // Retrieve the entry this.readEntry( msg -> { - Util.assertEntryClass(Protocol.SideEffectEntryMessage.class, msg); + Util.assertEntryClass(Protocol.RunEntryMessage.class, msg); // We have a result already, complete the callback - completeSideEffectCallbackWithEntry((Protocol.SideEffectEntryMessage) msg, callback); + completeSideEffectCallbackWithEntry((Protocol.RunEntryMessage) msg, callback); }, callback::onCancel); } else if (this.invocationState == InvocationState.PROCESSING) { @@ -431,7 +431,7 @@ void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) } void exitSideEffectBlock( - Protocol.SideEffectEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { + Protocol.RunEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { this.insideSideEffect = false; if (this.invocationState == InvocationState.CLOSED) { callback.onCancel(AbortedExecutionException.INSTANCE); @@ -454,7 +454,7 @@ void exitSideEffectBlock( this.writeEntry(sideEffectEntry); // Wait for entry to be acked - Protocol.SideEffectEntryMessage finalSideEffectEntry = sideEffectEntry; + Protocol.RunEntryMessage finalSideEffectEntry = sideEffectEntry; this.sideEffectAckStateMachine.waitLastSideEffectAck( new SideEffectAckStateMachine.SideEffectAckCallback() { @Override @@ -480,7 +480,7 @@ public void onError(Throwable e) { } void completeSideEffectCallbackWithEntry( - Protocol.SideEffectEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { + Protocol.RunEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { if (sideEffectEntry.hasFailure()) { callback.onFailure(Util.toRestateException(sideEffectEntry.getFailure())); } else { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java index 7e871da6..292526a3 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java @@ -78,11 +78,11 @@ public static MessageHeader fromMessage(MessageLite msg) { ? DONE_FLAG : 0, msg.getSerializedSize()); - } else if (msg instanceof Protocol.InvokeEntryMessage) { + } else if (msg instanceof Protocol.CallEntryMessage) { return new MessageHeader( - MessageType.InvokeEntryMessage, - ((Protocol.InvokeEntryMessage) msg).getResultCase() - != Protocol.InvokeEntryMessage.ResultCase.RESULT_NOT_SET + MessageType.CallEntryMessage, + ((Protocol.CallEntryMessage) msg).getResultCase() + != Protocol.CallEntryMessage.ResultCase.RESULT_NOT_SET ? DONE_FLAG : 0, msg.getSerializedSize()); @@ -94,9 +94,9 @@ public static MessageHeader fromMessage(MessageLite msg) { ? DONE_FLAG : 0, msg.getSerializedSize()); - } else if (msg instanceof Protocol.SideEffectEntryMessage) { + } else if (msg instanceof Protocol.RunEntryMessage) { return new MessageHeader( - MessageType.SideEffectEntryMessage, REQUIRES_ACK_FLAG, msg.getSerializedSize()); + MessageType.RunEntryMessage, REQUIRES_ACK_FLAG, msg.getSerializedSize()); } // Messages with no flags return new MessageHeader(MessageType.fromMessage(msg), 0, msg.getSerializedSize()); diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java index 486756c6..69fe5bd0 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java @@ -34,11 +34,11 @@ public enum MessageType { // Syscalls SleepEntryMessage, - InvokeEntryMessage, - BackgroundInvokeEntryMessage, + CallEntryMessage, + OneWayCallEntryMessage, AwakeableEntryMessage, CompleteAwakeableEntryMessage, - SideEffectEntryMessage, + RunEntryMessage, // SDK specific CombinatorAwaitableEntryMessage; @@ -94,18 +94,18 @@ public Parser messageParser() { return Protocol.GetStateKeysEntryMessage.parser(); case SleepEntryMessage: return Protocol.SleepEntryMessage.parser(); - case InvokeEntryMessage: - return Protocol.InvokeEntryMessage.parser(); - case BackgroundInvokeEntryMessage: - return Protocol.BackgroundInvokeEntryMessage.parser(); + case CallEntryMessage: + return Protocol.CallEntryMessage.parser(); + case OneWayCallEntryMessage: + return Protocol.OneWayCallEntryMessage.parser(); case AwakeableEntryMessage: return Protocol.AwakeableEntryMessage.parser(); case CompleteAwakeableEntryMessage: return Protocol.CompleteAwakeableEntryMessage.parser(); case CombinatorAwaitableEntryMessage: return Java.CombinatorAwaitableEntryMessage.parser(); - case SideEffectEntryMessage: - return Protocol.SideEffectEntryMessage.parser(); + case RunEntryMessage: + return Protocol.RunEntryMessage.parser(); } throw new IllegalStateException(); } @@ -140,9 +140,9 @@ public short encode() { return GET_STATE_KEYS_ENTRY_MESSAGE_TYPE; case SleepEntryMessage: return SLEEP_ENTRY_MESSAGE_TYPE; - case InvokeEntryMessage: + case CallEntryMessage: return INVOKE_ENTRY_MESSAGE_TYPE; - case BackgroundInvokeEntryMessage: + case OneWayCallEntryMessage: return BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE; case AwakeableEntryMessage: return AWAKEABLE_ENTRY_MESSAGE_TYPE; @@ -150,7 +150,7 @@ public short encode() { return COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE; case CombinatorAwaitableEntryMessage: return COMBINATOR_AWAITABLE_ENTRY_MESSAGE_TYPE; - case SideEffectEntryMessage: + case RunEntryMessage: return SIDE_EFFECT_ENTRY_MESSAGE_TYPE; } throw new IllegalStateException(); @@ -187,9 +187,9 @@ public static MessageType decode(short value) throws ProtocolException { case SLEEP_ENTRY_MESSAGE_TYPE: return SleepEntryMessage; case INVOKE_ENTRY_MESSAGE_TYPE: - return InvokeEntryMessage; + return CallEntryMessage; case BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE: - return BackgroundInvokeEntryMessage; + return OneWayCallEntryMessage; case AWAKEABLE_ENTRY_MESSAGE_TYPE: return AwakeableEntryMessage; case COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE: @@ -197,7 +197,7 @@ public static MessageType decode(short value) throws ProtocolException { case COMBINATOR_AWAITABLE_ENTRY_MESSAGE_TYPE: return CombinatorAwaitableEntryMessage; case SIDE_EFFECT_ENTRY_MESSAGE_TYPE: - return SideEffectEntryMessage; + return RunEntryMessage; } throw ProtocolException.unknownMessageType(value); } @@ -227,18 +227,18 @@ public static MessageType fromMessage(MessageLite msg) { return MessageType.GetStateKeysEntryMessage; } else if (msg instanceof Protocol.SleepEntryMessage) { return MessageType.SleepEntryMessage; - } else if (msg instanceof Protocol.InvokeEntryMessage) { - return MessageType.InvokeEntryMessage; - } else if (msg instanceof Protocol.BackgroundInvokeEntryMessage) { - return MessageType.BackgroundInvokeEntryMessage; + } else if (msg instanceof Protocol.CallEntryMessage) { + return MessageType.CallEntryMessage; + } else if (msg instanceof Protocol.OneWayCallEntryMessage) { + return MessageType.OneWayCallEntryMessage; } else if (msg instanceof Protocol.AwakeableEntryMessage) { return MessageType.AwakeableEntryMessage; } else if (msg instanceof Protocol.CompleteAwakeableEntryMessage) { return MessageType.CompleteAwakeableEntryMessage; } else if (msg instanceof Java.CombinatorAwaitableEntryMessage) { return MessageType.CombinatorAwaitableEntryMessage; - } else if (msg instanceof Protocol.SideEffectEntryMessage) { - return MessageType.SideEffectEntryMessage; + } else if (msg instanceof Protocol.RunEntryMessage) { + return MessageType.RunEntryMessage; } else if (msg instanceof Protocol.CompletionMessage) { throw new IllegalArgumentException("SDK should never send a CompletionMessage"); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java b/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java index 54a67063..8e32f507 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java @@ -11,8 +11,8 @@ import dev.restate.sdk.common.BindableServiceFactory; import dev.restate.sdk.common.syscalls.HandlerDefinition; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; +import dev.restate.sdk.core.manifest.Service; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; @@ -94,9 +94,7 @@ public DeploymentManifestSchema handleDiscoveryRequest() { DeploymentManifestSchema response = this.deploymentManifest.manifest(); LOG.info( "Replying to discovery request with services [{}]", - response.getComponents().stream() - .map(Component::getFullyQualifiedComponentName) - .collect(Collectors.joining(","))); + response.getServices().stream().map(Service::getName).collect(Collectors.joining(","))); return response; } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java index ce5ecdb0..31cfc338 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java @@ -174,10 +174,10 @@ public void call( () -> { LOG.trace("call {}", target); - Protocol.InvokeEntryMessage.Builder builder = - Protocol.InvokeEntryMessage.newBuilder() + Protocol.CallEntryMessage.Builder builder = + Protocol.CallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()) + .setHandlerName(target.getHandler()) .setParameter(parameter); if (target.getKey() != null) { builder.setKey(target.getKey()); @@ -199,10 +199,10 @@ public void send( () -> { LOG.trace("backgroundCall {}", target); - Protocol.BackgroundInvokeEntryMessage.Builder builder = - Protocol.BackgroundInvokeEntryMessage.newBuilder() + Protocol.OneWayCallEntryMessage.Builder builder = + Protocol.OneWayCallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()) + .setHandlerName(target.getHandler()) .setParameter(parameter); if (target.getKey() != null) { builder.setKey(target.getKey()); @@ -233,7 +233,7 @@ public void exitSideEffectBlock(ByteString toWrite, ExitSideEffectSyscallCallbac () -> { LOG.trace("exitSideEffectBlock with success"); this.stateMachine.exitSideEffectBlock( - Protocol.SideEffectEntryMessage.newBuilder().setValue(toWrite).build(), callback); + Protocol.RunEntryMessage.newBuilder().setValue(toWrite).build(), callback); }, callback); } @@ -245,7 +245,7 @@ public void exitSideEffectBlockWithTerminalException( () -> { LOG.trace("exitSideEffectBlock with failure"); this.stateMachine.exitSideEffectBlock( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure(Util.toProtocolFailure(toWrite)) .build(), callback); diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/Util.java b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java index ba3da434..96613044 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/Util.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java @@ -149,11 +149,11 @@ static boolean isEntry(MessageLite msg) { || msg instanceof Protocol.ClearStateEntryMessage || msg instanceof Protocol.ClearAllStateEntryMessage || msg instanceof Protocol.SleepEntryMessage - || msg instanceof Protocol.InvokeEntryMessage - || msg instanceof Protocol.BackgroundInvokeEntryMessage + || msg instanceof Protocol.CallEntryMessage + || msg instanceof Protocol.OneWayCallEntryMessage || msg instanceof Protocol.AwakeableEntryMessage || msg instanceof Protocol.CompleteAwakeableEntryMessage || msg instanceof Java.CombinatorAwaitableEntryMessage - || msg instanceof Protocol.SideEffectEntryMessage; + || msg instanceof Protocol.RunEntryMessage; } } diff --git a/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto index 3f31ebf7..2518c5d2 100644 --- a/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto +++ b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto @@ -313,7 +313,7 @@ message RunEntryMessage { // --- Nested messages // This failure object carries user visible errors, -// e.g. invocation failure return value or failure result of an InvokeEntryMessage. +// e.g. invocation failure return value or failure result of an CallEntryMessage. message Failure { // The code can be any HTTP status code, as described https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml. uint32 code = 1; diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java b/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java index e095dbb3..ca860d4a 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java @@ -14,9 +14,9 @@ import dev.restate.sdk.common.ServiceType; import dev.restate.sdk.common.syscalls.HandlerDefinition; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; import dev.restate.sdk.core.manifest.DeploymentManifestSchema.ProtocolMode; +import dev.restate.sdk.core.manifest.Service; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.api.Test; @@ -38,9 +38,7 @@ void handleWithMultipleServices() { DeploymentManifestSchema manifest = deploymentManifest.manifest(); - assertThat(manifest.getComponents()) - .extracting(Component::getFullyQualifiedComponentName) - .containsOnly("MyGreeter"); + assertThat(manifest.getServices()).extracting(Service::getName).containsOnly("MyGreeter"); assertThat(manifest.getProtocolMode()).isEqualTo(ProtocolMode.REQUEST_RESPONSE); } } diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java b/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java index 3de3267d..7f48cb39 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java @@ -19,7 +19,7 @@ public class MessageHeaderTest { void requiresAckFlag() { assertThat( new MessageHeader( - MessageType.InvokeEntryMessage, + MessageType.CallEntryMessage, MessageHeader.DONE_FLAG | MessageHeader.REQUIRES_ACK_FLAG, 2) .encode()) diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java index 431895b4..b96d5289 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java @@ -190,11 +190,11 @@ public static Protocol.ClearStateEntryMessage clearStateMessage(String key) { .build(); } - public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target) { - Protocol.InvokeEntryMessage.Builder builder = - Protocol.InvokeEntryMessage.newBuilder() + public static Protocol.CallEntryMessage.Builder invokeMessage(Target target) { + Protocol.CallEntryMessage.Builder builder = + Protocol.CallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()); + .setHandlerName(target.getHandler()); if (target.getKey() != null) { builder.setKey(target.getKey()); } @@ -202,23 +202,23 @@ public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target) { return builder; } - public static Protocol.InvokeEntryMessage.Builder invokeMessage( + public static Protocol.CallEntryMessage.Builder invokeMessage( Target target, Serde reqSerde, T parameter) { return invokeMessage(target).setParameter(reqSerde.serializeToByteString(parameter)); } - public static Protocol.InvokeEntryMessage invokeMessage( + public static Protocol.CallEntryMessage invokeMessage( Target target, Serde reqSerde, T parameter, Serde resSerde, R result) { return invokeMessage(target, reqSerde, parameter) .setValue(resSerde.serializeToByteString(result)) .build(); } - public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target, String parameter) { + public static Protocol.CallEntryMessage.Builder invokeMessage(Target target, String parameter) { return invokeMessage(target, CoreSerdes.JSON_STRING, parameter); } - public static Protocol.InvokeEntryMessage invokeMessage( + public static Protocol.CallEntryMessage invokeMessage( Target target, String parameter, String result) { return invokeMessage(target, CoreSerdes.JSON_STRING, parameter, CoreSerdes.JSON_STRING, result); } diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java index 7394a675..756188e3 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java @@ -40,14 +40,14 @@ public Stream definitions() { this.sideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)) .named("Without optimization suspends"), this.sideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till"), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), outputMessage("Hello Francesco"), END_MESSAGE) @@ -55,14 +55,14 @@ public Stream definitions() { this.namedSideEffect("get-my-name", "Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setName("get-my-name") .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)), this.consecutiveSideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)) .named("With optimization and without ack on first side effect will suspend"), @@ -70,9 +70,9 @@ public Stream definitions() { .withInput(startMessage(1), inputMessage("Till"), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("FRANCESCO")), suspensionMessage(2)) .named("With optimization and ack on first side effect will suspend"), @@ -80,9 +80,9 @@ public Stream definitions() { .withInput(startMessage(1), inputMessage("Till"), ackMessage(1), ackMessage(2)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("FRANCESCO")), outputMessage("Hello FRANCESCO"), END_MESSAGE) @@ -100,7 +100,7 @@ public Stream definitions() { Protocol.ErrorMessage::getCode) .returns(1, Protocol.ErrorMessage::getRelatedEntryIndex) .returns( - (int) MessageType.SideEffectEntryMessage.encode(), + (int) MessageType.RunEntryMessage.encode(), Protocol.ErrorMessage::getRelatedEntryType) .returns( "my-side-effect", Protocol.ErrorMessage::getRelatedEntryName) @@ -116,8 +116,8 @@ public Stream definitions() { assertThat(actualOutputMessages).hasSize(3); assertThat(actualOutputMessages) .element(0) - .asInstanceOf(type(Protocol.SideEffectEntryMessage.class)) - .returns(true, Protocol.SideEffectEntryMessage::hasValue); + .asInstanceOf(type(Protocol.RunEntryMessage.class)) + .returns(true, Protocol.RunEntryMessage::hasValue); assertThat(actualOutputMessages).element(1).isEqualTo(outputMessage("Hello")); assertThat(actualOutputMessages).element(2).isEqualTo(END_MESSAGE); }), diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java index 300b3b8a..cbf1beae 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java @@ -77,8 +77,7 @@ public Stream definitions() { errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) .named("Serde serialization error"), this.sideEffectFailure(FAILING_DESERIALIZATION_INTEGER_TYPE_TAG) - .withInput( - startMessage(2), inputMessage("Till"), Protocol.SideEffectEntryMessage.newBuilder()) + .withInput(startMessage(2), inputMessage("Till"), Protocol.RunEntryMessage.newBuilder()) .assertingOutput( AssertUtils.containsOnly( errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java index 95963156..beab7bce 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java @@ -69,7 +69,7 @@ public Stream definitions() { TerminalException.INTERNAL_SERVER_ERROR_CODE, MY_ERROR) .withInput(startMessage(1), inputMessage(), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure( Util.toProtocolFailure( TerminalException.INTERNAL_SERVER_ERROR_CODE, MY_ERROR)), @@ -79,7 +79,7 @@ public Stream definitions() { this.sideEffectThrowTerminalException(501, WHATEVER) .withInput(startMessage(1), inputMessage(), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure(Util.toProtocolFailure(501, WHATEVER)), outputMessage(501, WHATEVER), END_MESSAGE) diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt index 27658729..4f121a70 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt @@ -215,8 +215,8 @@ internal class RestateHttpEndpointTest { val discoveryResponse: DeploymentManifestSchema = ObjectMapper().readValue(responseBody.bytes, DeploymentManifestSchema::class.java) - assertThat(discoveryResponse.components) - .map { it.fullyQualifiedComponentName } + assertThat(discoveryResponse.services) + .map { it.name } .containsOnly(BlockingGreeter::class.java.simpleName) } diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt index d87ef256..0040a7b6 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt @@ -76,7 +76,7 @@ class VertxExecutorsTest : TestDefinitions.TestSuite { .withInput(startMessage(1), inputMessage(), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), + Protocol.RunEntryMessage.newBuilder().setValue(ByteString.EMPTY), outputMessage(), END_MESSAGE), testInvocation( @@ -90,7 +90,7 @@ class VertxExecutorsTest : TestDefinitions.TestSuite { .withInput(startMessage(1), inputMessage(), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), + Protocol.RunEntryMessage.newBuilder().setValue(ByteString.EMPTY), outputMessage(), END_MESSAGE)) } diff --git a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java index 5b797c40..6333ef2c 100644 --- a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java +++ b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java @@ -21,8 +21,8 @@ import com.google.protobuf.MessageLite; import dev.restate.generated.service.protocol.Protocol; import dev.restate.sdk.core.ProtoUtils; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; +import dev.restate.sdk.core.manifest.Service; import dev.restate.sdk.lambda.testservices.JavaCounterClient; import dev.restate.sdk.lambda.testservices.MyServicesHandler; import java.io.ByteArrayOutputStream; @@ -95,8 +95,8 @@ public void testDiscovery() throws IOException { DeploymentManifestSchema discoveryResponse = new ObjectMapper().readValue(decodedStringResponse, DeploymentManifestSchema.class); - assertThat(discoveryResponse.getComponents()) - .map(Component::getFullyQualifiedComponentName) + assertThat(discoveryResponse.getServices()) + .map(Service::getName) .containsOnly(JavaCounterClient.SERVICE_NAME, "KtCounter"); } diff --git a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java index cf62c52b..5f4726e5 100644 --- a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java @@ -103,8 +103,8 @@ public void run() { .uri("http://host.testcontainers.internal:" + serviceEndpointPort))); LOG.debug( "Registered services {}", - response.getComponents().stream() - .map(dev.restate.admin.model.ComponentMetadata::getName) + response.getServices().stream() + .map(dev.restate.admin.model.ServiceMetadata::getName) .collect(Collectors.toList())); } catch (ApiException e) { throw new RuntimeException(e);