From b8eabffc38ec8b85d00f72d98e4389ff0037a9ad Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 27 Nov 2023 10:21:22 +0100 Subject: [PATCH 1/2] Renamings --- README.md | 10 +-- build.gradle.kts | 12 +-- examples/build.gradle.kts | 8 +- .../dev/restate/sdk/examples/Counter.java | 6 +- .../sdk/examples/VanillaGrpcCounter.java | 8 +- .../dev/restate/sdk/examples/CounterKt.kt | 4 +- .../build.gradle.kts | 6 +- .../dev/restate/sdk}/gen/CodeGenUtils.java | 2 +- .../java/dev/restate/sdk/gen/JavaGen.java | 36 ++++---- .../src/main/resources/blockingStub.mustache | 12 +-- sdk-api-common/build.gradle.kts | 14 +++ .../common}/AbortedExecutionException.java | 2 +- .../sdk/common}/BindableBlockingService.java | 2 +- .../common}/BindableNonBlockingService.java | 2 +- .../dev/restate/sdk/common}/CoreSerdes.java | 2 +- .../dev/restate/sdk/common}/InvocationId.java | 2 +- .../java/dev/restate/sdk/common}/Serde.java | 4 +- .../dev/restate/sdk/common}/StateKey.java | 2 +- .../sdk/common}/TerminalException.java | 2 +- .../common}/function/ThrowingFunction.java | 2 +- .../common}/function/ThrowingRunnable.java | 2 +- .../common}/function/ThrowingSupplier.java | 2 +- .../sdk/common}/syscalls/DeferredResult.java | 2 +- .../EnterSideEffectSyscallCallback.java | 2 +- .../ExitSideEffectSyscallCallback.java | 4 +- .../sdk/common}/syscalls/ReadyResult.java | 4 +- .../common}/syscalls/ReadyResultHolder.java | 2 +- .../sdk/common}/syscalls/SyscallCallback.java | 2 +- .../sdk/common}/syscalls/Syscalls.java | 4 +- .../main/proto}/.github/workflows/lint.yaml | 0 .../src/main/proto}/.gitignore | 0 .../src/main/proto/.protolint.yaml | 0 .../src/main/proto}/LICENSE | 0 .../src/main/proto/README.md | 0 .../src/main/proto/buf.yaml | 0 .../src/main/proto/dev/restate/events.proto | 7 +- .../src/main/proto/dev/restate/ext.proto | 7 +- .../src/main/proto/dev/restate/services.proto | 7 +- .../restate/sdk/common}/CoreSerdesTest.java | 2 +- .../build.gradle.kts | 10 +-- .../dev/restate/sdk/kotlin/Awaitables.kt | 8 +- .../restate/sdk/kotlin/RestateContextImpl.kt | 12 +-- .../kotlin/dev/restate/sdk/kotlin/Util.kt | 6 +- .../main/kotlin/dev/restate/sdk/kotlin/api.kt | 10 +-- .../dev/restate/sdk/kotlin/AwakeableIdTest.kt | 12 +-- .../dev/restate/sdk/kotlin/DeferredTest.kt | 10 +-- .../dev/restate/sdk/kotlin/EagerStateTest.kt | 14 +-- .../restate/sdk/kotlin/InvocationIdTest.kt | 12 +-- .../sdk/kotlin/KotlinCoroutinesTests.kt | 10 +-- .../sdk/kotlin/OnlyInputAndOutputTest.kt | 10 +-- .../dev/restate/sdk/kotlin/SideEffectTest.kt | 6 +- .../dev/restate/sdk/kotlin/SleepTest.kt | 10 +-- .../sdk/kotlin/StateMachineFailuresTest.kt | 16 ++-- .../dev/restate/sdk/kotlin/StateTest.kt | 14 +-- .../restate/sdk/kotlin/UserFailuresTest.kt | 10 +-- .../build.gradle.kts | 18 ++-- .../java/dev/restate/sdk}/AnyAwaitable.java | 6 +- .../main/java/dev/restate/sdk}/Awaitable.java | 12 +-- .../main/java/dev/restate/sdk}/Awakeable.java | 8 +- .../dev/restate/sdk}/AwakeableHandle.java | 4 +- .../dev/restate/sdk}/GrpcChannelAdapter.java | 2 +- .../restate/sdk}/RestateBlockingService.java | 11 +-- .../java/dev/restate/sdk}/RestateContext.java | 10 +-- .../dev/restate/sdk}/RestateContextImpl.java | 17 ++-- .../src/main/java/dev/restate/sdk}/Util.java | 14 +-- .../dev/restate/sdk}/AwakeableIdTest.java | 14 +-- .../java/dev/restate/sdk}/DeferredTest.java | 18 ++-- .../java/dev/restate/sdk}/EagerStateTest.java | 14 +-- .../restate/sdk}/GrpcChannelAdapterTest.java | 18 ++-- .../dev/restate/sdk}/InvocationIdTest.java | 14 +-- .../dev/restate/sdk}/JavaBlockingTests.java | 12 +-- .../restate/sdk}/OnlyInputAndOutputTest.java | 10 +-- .../dev/restate/sdk}/RestateCodegenTest.java | 8 +- .../java/dev/restate/sdk}/SideEffectTest.java | 14 +-- .../test/java/dev/restate/sdk}/SleepTest.java | 10 +-- .../sdk}/StateMachineFailuresTest.java | 20 ++--- .../test/java/dev/restate/sdk}/StateTest.java | 18 ++-- .../dev/restate/sdk}/UserFailuresTest.java | 28 +++--- sdk-core-impl/build.gradle.kts | 54 ------------ ...ogging.log4j.core.util.ContextDataProvider | 1 - sdk-core/build.gradle.kts | 46 +++++++++- .../BaseSuspendableCallbackStateMachine.java | 2 +- .../dev/restate/sdk/core}/CallbackHandle.java | 2 +- .../restate/sdk/core}/DeferredResults.java | 4 +- .../java/dev/restate/sdk/core}/Entries.java | 4 +- ...tionCatchingInvocationInputSubscriber.java | 2 +- .../sdk/core}/ExecutorSwitchingWrappers.java | 10 ++- .../sdk/core}/GrpcContextDataProvider.java | 4 +- .../core}/GrpcServerCallListenerAdaptor.java | 2 +- .../core}/IncomingEntriesStateMachine.java | 2 +- .../sdk/core}/InputPublisherState.java | 4 +- .../dev/restate/sdk/core}/InvocationFlow.java | 2 +- .../restate/sdk/core}/InvocationHandler.java | 2 +- .../restate/sdk/core}/InvocationIdImpl.java | 4 +- .../sdk/core}/InvocationStateMachine.java | 85 ++++++++++--------- .../dev/restate/sdk/core}/MessageHeader.java | 2 +- .../dev/restate/sdk/core}/MessageType.java | 2 +- .../restate/sdk/core}/ProtocolException.java | 2 +- .../sdk/core}/ReadyResultStateMachine.java | 17 ++-- .../dev/restate/sdk/core}/ReadyResults.java | 6 +- .../restate/sdk/core}/RestateGrpcServer.java | 6 +- .../restate/sdk/core}/RestateServerCall.java | 6 +- .../sdk/core}/RestateServerCallListener.java | 2 +- .../sdk/core}/ServiceDiscoveryHandler.java | 2 +- .../sdk/core}/SideEffectAckStateMachine.java | 2 +- .../sdk/core}/SuspendableCallback.java | 2 +- .../dev/restate/sdk/core}/SyscallsImpl.java | 24 +++--- .../restate/sdk/core}/SyscallsInternal.java | 8 +- .../java/dev/restate/sdk/core}/Tracing.java | 2 +- .../dev/restate/sdk/core}/UserStateStore.java | 2 +- .../main/java/dev/restate/sdk/core}/Util.java | 6 +- ...ogging.log4j.core.util.ContextDataProvider | 1 + .../main/sdk-proto/dev/restate/sdk/java.proto | 0 .../.github/workflows/lint.yaml | 0 .../{proto => service-protocol}/.gitignore | 0 .../main/service-protocol/.prettierrc.toml | 0 .../src/main/service-protocol/.protolint.yaml | 0 .../main/{proto => service-protocol}/LICENSE | 0 .../src/main/service-protocol/README.md | 0 .../dev/restate/service/discovery.proto | 7 +- .../dev/restate/service/protocol.proto | 7 +- .../service-invocation-protocol.md | 0 .../dev/restate/sdk/core}/AssertUtils.java | 2 +- .../sdk/core}/AwakeableIdTestSuite.java | 16 ++-- .../restate/sdk/core}/DeferredTestSuite.java | 10 +-- .../sdk/core}/EagerStateTestSuite.java | 8 +- .../java/dev/restate/sdk/core}/FlowUtils.java | 2 +- .../sdk/core}/InvocationIdTestSuite.java | 14 +-- .../restate/sdk/core}/MockMultiThreaded.java | 2 +- .../restate/sdk/core}/MockSingleThread.java | 6 +- .../core}/OnlyInputAndOutputTestSuite.java | 16 ++-- .../dev/restate/sdk/core}/ProtoUtils.java | 18 ++-- .../core}/ServiceDiscoveryHandlerTest.java | 6 +- .../sdk/core}/SideEffectTestSuite.java | 28 +++--- .../dev/restate/sdk/core}/SleepTestSuite.java | 23 ++--- .../core}/StateMachineFailuresTestSuite.java | 39 +++++---- .../dev/restate/sdk/core}/StateTestSuite.java | 19 ++--- .../restate/sdk/core}/TestDefinitions.java | 4 +- .../dev/restate/sdk/core}/TestRunner.java | 8 +- .../sdk/core}/UserFailuresTestSuite.java | 20 +++-- .../src/test/proto/codegen.proto | 2 +- .../src/test/proto/common.proto | 2 +- .../src/test/proto/counter.proto | 2 +- .../src/test/proto/greeter.proto | 2 +- .../test/resources/junit-platform.properties | 0 .../src/test/resources/log4j2.properties | 0 sdk-http-vertx/build.gradle.kts | 17 ++-- .../http/vertx/HttpRequestFlowAdapter.java | 2 +- .../http/vertx/HttpResponseFlowAdapter.java | 4 +- .../sdk/http/vertx/MessageDecoder.java | 4 +- .../sdk/http/vertx/MessageEncoder.java | 2 +- .../http/vertx/RequestHttpServerHandler.java | 8 +- .../vertx/RestateHttpEndpointBuilder.java | 6 +- .../testservices/BlockingGreeterService.java | 12 +-- .../sdk/http/vertx/HttpVertxTestExecutor.kt | 8 +- .../restate/sdk/http/vertx/HttpVertxTests.kt | 78 ++++++++++------- .../sdk/http/vertx/RestateHttpEndpointTest.kt | 15 ++-- .../vertx/testservices/GreeterKtService.kt | 8 +- sdk-lambda/build.gradle.kts | 11 ++- .../sdk/lambda/LambdaFlowAdapters.java | 4 +- .../sdk/lambda/RestateLambdaEndpoint.java | 6 +- .../lambda/RestateLambdaEndpointBuilder.java | 6 +- .../restate/sdk/lambda/LambdaHandlerTest.java | 4 +- .../testservices/JavaCounterService.java | 6 +- sdk-serde-jackson/build.gradle.kts | 2 +- .../serde/jackson/JacksonSerdes.java | 4 +- .../jackson}/JacksonSerdesTest.java | 4 +- {sdk-test => sdk-testing}/build.gradle.kts | 4 +- .../sdk/testing/BaseRestateRunner.java | 0 .../sdk/testing/ManualRestateRunner.java | 0 .../sdk/testing/RestateAdminClient.java | 0 .../sdk/testing/RestateGrpcChannel.java | 0 .../restate/sdk/testing/RestateRunner.java | 0 .../sdk/testing/RestateRunnerBuilder.java | 4 +- .../dev/restate/sdk/testing/RestateURL.java | 0 .../java/dev/restate/sdk/testing/Counter.java | 8 +- .../dev/restate/sdk/testing/CounterTest.java | 0 .../src/test/proto/counter.proto | 0 .../src/test/resources/log4j2.properties | 0 settings.gradle.kts | 10 +-- 180 files changed, 756 insertions(+), 721 deletions(-) rename {protoc-gen-restate-java-blocking => protoc-gen-restate}/build.gradle.kts (78%) rename {protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking => protoc-gen-restate/src/main/java/dev/restate/sdk}/gen/CodeGenUtils.java (99%) rename protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/JavaBlockingGen.java => protoc-gen-restate/src/main/java/dev/restate/sdk/gen/JavaGen.java (88%) rename {protoc-gen-restate-java-blocking => protoc-gen-restate}/src/main/resources/blockingStub.mustache (94%) create mode 100644 sdk-api-common/build.gradle.kts rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/AbortedExecutionException.java (96%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/BindableBlockingService.java (93%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/BindableNonBlockingService.java (93%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/CoreSerdes.java (99%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/InvocationId.java (96%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/Serde.java (94%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/StateKey.java (97%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/TerminalException.java (98%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/function/ThrowingFunction.java (96%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/function/ThrowingRunnable.java (92%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/function/ThrowingSupplier.java (93%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/DeferredResult.java (95%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/EnterSideEffectSyscallCallback.java (91%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/ExitSideEffectSyscallCallback.java (85%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/ReadyResult.java (92%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/ReadyResultHolder.java (97%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/SyscallCallback.java (98%) rename {sdk-core/src/main/java/dev/restate/sdk/core => sdk-api-common/src/main/java/dev/restate/sdk/common}/syscalls/Syscalls.java (97%) rename {sdk-core-impl/src/main/service-protocol => sdk-api-common/src/main/proto}/.github/workflows/lint.yaml (100%) rename {sdk-core-impl/src/main/service-protocol => sdk-api-common/src/main/proto}/.gitignore (100%) rename {sdk-core => sdk-api-common}/src/main/proto/.protolint.yaml (100%) rename {sdk-core-impl/src/main/service-protocol => sdk-api-common/src/main/proto}/LICENSE (100%) rename {sdk-core => sdk-api-common}/src/main/proto/README.md (100%) rename {sdk-core => sdk-api-common}/src/main/proto/buf.yaml (100%) rename {sdk-core => sdk-api-common}/src/main/proto/dev/restate/events.proto (77%) rename {sdk-core => sdk-api-common}/src/main/proto/dev/restate/ext.proto (90%) rename {sdk-core => sdk-api-common}/src/main/proto/dev/restate/services.proto (93%) rename {sdk-core/src/test/java/dev/restate/sdk/core => sdk-api-common/src/test/java/dev/restate/sdk/common}/CoreSerdesTest.java (98%) rename {sdk-kotlin => sdk-api-kotlin}/build.gradle.kts (83%) rename {sdk-kotlin => sdk-api-kotlin}/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt (96%) rename {sdk-kotlin => sdk-api-kotlin}/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt (94%) rename {sdk-kotlin => sdk-api-kotlin}/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt (91%) rename {sdk-kotlin => sdk-api-kotlin}/src/main/kotlin/dev/restate/sdk/kotlin/api.kt (98%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt (72%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt (96%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt (87%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt (71%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt (78%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt (74%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt (95%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt (83%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt (83%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt (81%) rename {sdk-kotlin => sdk-api-kotlin}/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt (91%) rename {sdk-java-blocking => sdk-api}/build.gradle.kts (71%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/AnyAwaitable.java (86%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/Awaitable.java (92%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/Awakeable.java (90%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/AwakeableHandle.java (93%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/GrpcChannelAdapter.java (98%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/RestateBlockingService.java (75%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/RestateContext.java (97%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/RestateContextImpl.java (91%) rename {sdk-java-blocking/src/main/java/dev/restate/sdk/blocking => sdk-api/src/main/java/dev/restate/sdk}/Util.java (88%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/AwakeableIdTest.java (71%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/DeferredTest.java (93%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/EagerStateTest.java (90%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/GrpcChannelAdapterTest.java (87%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/InvocationIdTest.java (70%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/JavaBlockingTests.java (77%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/OnlyInputAndOutputTest.java (77%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/RestateCodegenTest.java (97%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/SideEffectTest.java (90%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/SleepTest.java (87%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/StateMachineFailuresTest.java (83%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/StateTest.java (85%) rename {sdk-java-blocking/src/test/java/dev/restate/sdk/blocking => sdk-api/src/test/java/dev/restate/sdk}/UserFailuresTest.java (87%) delete mode 100644 sdk-core-impl/build.gradle.kts delete mode 100644 sdk-core-impl/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/BaseSuspendableCallbackStateMachine.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/CallbackHandle.java (96%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/DeferredResults.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/Entries.java (99%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ExceptionCatchingInvocationInputSubscriber.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ExecutorSwitchingWrappers.java (94%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/GrpcContextDataProvider.java (94%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/GrpcServerCallListenerAdaptor.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/IncomingEntriesStateMachine.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/InputPublisherState.java (89%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/InvocationFlow.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/InvocationHandler.java (95%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/InvocationIdImpl.java (91%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/InvocationStateMachine.java (88%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/MessageHeader.java (99%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/MessageType.java (99%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ProtocolException.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ReadyResultStateMachine.java (81%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ReadyResults.java (95%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/RestateGrpcServer.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/RestateServerCall.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/RestateServerCallListener.java (95%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/ServiceDiscoveryHandler.java (98%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/SideEffectAckStateMachine.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/SuspendableCallback.java (92%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/SyscallsImpl.java (94%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/SyscallsInternal.java (82%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/Tracing.java (96%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/UserStateStore.java (97%) rename {sdk-core-impl/src/main/java/dev/restate/sdk/core/impl => sdk-core/src/main/java/dev/restate/sdk/core}/Util.java (96%) create mode 100644 sdk-core/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider rename {sdk-core-impl => sdk-core}/src/main/sdk-proto/dev/restate/sdk/java.proto (100%) rename sdk-core/src/main/{proto => service-protocol}/.github/workflows/lint.yaml (100%) rename sdk-core/src/main/{proto => service-protocol}/.gitignore (100%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/.prettierrc.toml (100%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/.protolint.yaml (100%) rename sdk-core/src/main/{proto => service-protocol}/LICENSE (100%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/README.md (100%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/dev/restate/service/discovery.proto (88%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/dev/restate/service/protocol.proto (97%) rename {sdk-core-impl => sdk-core}/src/main/service-protocol/service-invocation-protocol.md (100%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/AssertUtils.java (98%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/AwakeableIdTestSuite.java (85%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/DeferredTestSuite.java (98%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/EagerStateTestSuite.java (96%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/FlowUtils.java (99%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/InvocationIdTestSuite.java (74%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/MockMultiThreaded.java (98%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/MockSingleThread.java (93%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/OnlyInputAndOutputTestSuite.java (67%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/ProtoUtils.java (94%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/ServiceDiscoveryHandlerTest.java (91%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/SideEffectTestSuite.java (85%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/SleepTestSuite.java (83%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/StateMachineFailuresTestSuite.java (74%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/StateTestSuite.java (88%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/TestDefinitions.java (98%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/TestRunner.java (94%) rename {sdk-core-impl/src/test/java/dev/restate/sdk/core/impl => sdk-core/src/test/java/dev/restate/sdk/core}/UserFailuresTestSuite.java (87%) rename {sdk-core-impl => sdk-core}/src/test/proto/codegen.proto (93%) rename {sdk-core-impl => sdk-core}/src/test/proto/common.proto (89%) rename {sdk-core-impl => sdk-core}/src/test/proto/counter.proto (94%) rename {sdk-core-impl => sdk-core}/src/test/proto/greeter.proto (92%) rename {sdk-core-impl => sdk-core}/src/test/resources/junit-platform.properties (100%) rename {sdk-core-impl => sdk-core}/src/test/resources/log4j2.properties (100%) rename sdk-serde-jackson/src/main/java/dev/restate/sdk/{core => }/serde/jackson/JacksonSerdes.java (96%) rename sdk-serde-jackson/src/test/java/dev/restate/sdk/{core => serde/jackson}/JacksonSerdesTest.java (96%) rename {sdk-test => sdk-testing}/build.gradle.kts (92%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/BaseRestateRunner.java (100%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java (100%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/RestateAdminClient.java (100%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/RestateGrpcChannel.java (100%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/RestateRunner.java (100%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java (96%) rename {sdk-test => sdk-testing}/src/main/java/dev/restate/sdk/testing/RestateURL.java (100%) rename {sdk-test => sdk-testing}/src/test/java/dev/restate/sdk/testing/Counter.java (92%) rename {sdk-test => sdk-testing}/src/test/java/dev/restate/sdk/testing/CounterTest.java (100%) rename {sdk-test => sdk-testing}/src/test/proto/counter.proto (100%) rename {sdk-test => sdk-testing}/src/test/resources/log4j2.properties (100%) diff --git a/README.md b/README.md index ec115cd2..b5f08bfa 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ Scaffold a project using the build tool of your choice. For example, with Gradle gradle init --type java-application ``` -Add the dependency [sdk-java-blocking](sdk-java-blocking): +Add the dependency [sdk-api](sdk-api): ``` -implementation("dev.restate.sdk:sdk-java-blocking:1.0-SNAPSHOT") +implementation("dev.restate.sdk:sdk-api:1.0-SNAPSHOT") ``` Now you need to configure the protobuf plugin to build your Protobuf contracts. For example, with Gradle (Kotlin script): @@ -61,7 +61,7 @@ protobuf { plugins { // The Restate plugin depends on the gRPC generated code id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:1.58.0" } - id("restate") { artifact = "dev.restate.sdk:protoc-gen-restate-java-blocking:1.0-SNAPSHOT:all@jar" } + id("restate") { artifact = "dev.restate.sdk:protoc-gen-restate:1.0-SNAPSHOT:all@jar" } } generateProtoTasks { @@ -85,10 +85,10 @@ Scaffold a project using the build tool of your choice. For example, with Gradle gradle init --type kotlin-application ``` -Add the dependency [`sdk-kotlin`](sdk-kotlin): +Add the dependency [`sdk-api-kotlin`](sdk-api-kotlin): ``` -implementation("dev.restate.sdk:sdk-kotlin:1.0-SNAPSHOT") +implementation("dev.restate.sdk:sdk-api-kotlin:1.0-SNAPSHOT") ``` Now you need to configure the protobuf plugin to build your Protobuf contracts. For example, with Gradle (Kotlin script): diff --git a/build.gradle.kts b/build.gradle.kts index d6b93769..00a4825f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,12 +17,6 @@ plugins { val protobufVersion = coreLibs.versions.protobuf.get() val restateVersion = libs.versions.restate.get() -val testReport = - tasks.register("testReport") { - destinationDirectory.set(file("${layout.buildDirectory}/reports/tests/test")) - testResults.setFrom(subprojects.mapNotNull { it.tasks.findByPath("test") }) - } - allprojects { apply(plugin = "com.diffplug.spotless") apply(plugin = "com.github.jk1.dependency-license-report") @@ -117,6 +111,12 @@ subprojects { options.errorprone.excludedPaths.set(".*/build/generated/.*") } + val testReport = + tasks.register("testReport") { + destinationDirectory.set(file("${layout.buildDirectory}/reports/tests/test")) + testResults.setFrom(subprojects.mapNotNull { it.tasks.findByPath("test") }) + } + // Test platform and reporting tasks.withType { useJUnitPlatform() diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 86ee5c0e..7c4c0de2 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -8,10 +8,10 @@ plugins { } dependencies { - implementation(project(":sdk-java-blocking")) + implementation(project(":sdk-api")) implementation(project(":sdk-lambda")) implementation(project(":sdk-http-vertx")) - implementation(project(":sdk-kotlin")) + implementation(project(":sdk-api-kotlin")) implementation(project(":sdk-serde-jackson")) implementation(coreLibs.protobuf.java) @@ -35,7 +35,7 @@ dependencies { val pluginJar = file( - "${project.rootProject.rootDir}/protoc-gen-restate-java-blocking/build/libs/protoc-gen-restate-java-blocking-${project.version}-all.jar") + "${project.rootProject.rootDir}/protoc-gen-restate/build/libs/protoc-gen-restate-${project.version}-all.jar") protobuf { plugins { @@ -52,7 +52,7 @@ protobuf { generateProtoTasks { ofSourceSet("main").forEach { - it.dependsOn(":protoc-gen-restate-java-blocking:shadowJar") + it.dependsOn(":protoc-gen-restate:shadowJar") it.plugins { id("grpc") id("grpckt") diff --git a/examples/src/main/java/dev/restate/sdk/examples/Counter.java b/examples/src/main/java/dev/restate/sdk/examples/Counter.java index 2a56b9cd..08b625f7 100644 --- a/examples/src/main/java/dev/restate/sdk/examples/Counter.java +++ b/examples/src/main/java/dev/restate/sdk/examples/Counter.java @@ -8,9 +8,9 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.examples; -import dev.restate.sdk.blocking.RestateContext; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.StateKey; +import dev.restate.sdk.RestateContext; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.StateKey; import dev.restate.sdk.examples.generated.*; import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder; import org.apache.logging.log4j.LogManager; diff --git a/examples/src/main/java/dev/restate/sdk/examples/VanillaGrpcCounter.java b/examples/src/main/java/dev/restate/sdk/examples/VanillaGrpcCounter.java index f26e12bf..d099c6a9 100644 --- a/examples/src/main/java/dev/restate/sdk/examples/VanillaGrpcCounter.java +++ b/examples/src/main/java/dev/restate/sdk/examples/VanillaGrpcCounter.java @@ -9,10 +9,10 @@ package dev.restate.sdk.examples; import com.google.protobuf.Empty; -import dev.restate.sdk.blocking.RestateBlockingService; -import dev.restate.sdk.blocking.RestateContext; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.StateKey; +import dev.restate.sdk.RestateBlockingService; +import dev.restate.sdk.RestateContext; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.StateKey; import dev.restate.sdk.examples.generated.*; import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder; import io.grpc.stub.StreamObserver; diff --git a/examples/src/main/kotlin/dev/restate/sdk/examples/CounterKt.kt b/examples/src/main/kotlin/dev/restate/sdk/examples/CounterKt.kt index 49c27a19..330a045e 100644 --- a/examples/src/main/kotlin/dev/restate/sdk/examples/CounterKt.kt +++ b/examples/src/main/kotlin/dev/restate/sdk/examples/CounterKt.kt @@ -9,8 +9,8 @@ package dev.restate.sdk.examples import com.google.protobuf.Empty -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.StateKey +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.common.StateKey import dev.restate.sdk.examples.generated.* import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder import dev.restate.sdk.kotlin.RestateCoroutineService diff --git a/protoc-gen-restate-java-blocking/build.gradle.kts b/protoc-gen-restate/build.gradle.kts similarity index 78% rename from protoc-gen-restate-java-blocking/build.gradle.kts rename to protoc-gen-restate/build.gradle.kts index 3349dd6b..f9bda1d4 100644 --- a/protoc-gen-restate-java-blocking/build.gradle.kts +++ b/protoc-gen-restate/build.gradle.kts @@ -7,17 +7,17 @@ plugins { `library-publishing-conventions` } -description = "Protoc plugin to generate interfaces compatible with dev.restate:sdk-java-blocking" +description = "Protoc plugin to generate interfaces compatible with dev.restate:sdk-api" dependencies { compileOnly(coreLibs.javax.annotation.api) implementation("com.salesforce.servicelibs:jprotoc:1.2.2") { exclude("javax.annotation", "javax.annotation-api") } - implementation(project(":sdk-core")) + implementation(project(":sdk-api-common")) } -application { mainClass.set("dev.restate.sdk.blocking.gen.JavaBlockingGen") } +application { mainClass.set("dev.restate.sdk.gen.JavaGen") } tasks.named("shadowJar") { // Override the default jar diff --git a/protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/CodeGenUtils.java b/protoc-gen-restate/src/main/java/dev/restate/sdk/gen/CodeGenUtils.java similarity index 99% rename from protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/CodeGenUtils.java rename to protoc-gen-restate/src/main/java/dev/restate/sdk/gen/CodeGenUtils.java index 4a3dcfb3..45e9ecca 100644 --- a/protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/CodeGenUtils.java +++ b/protoc-gen-restate/src/main/java/dev/restate/sdk/gen/CodeGenUtils.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking.gen; +package dev.restate.sdk.gen; import com.google.common.html.HtmlEscapers; import com.google.protobuf.DescriptorProtos; diff --git a/protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/JavaBlockingGen.java b/protoc-gen-restate/src/main/java/dev/restate/sdk/gen/JavaGen.java similarity index 88% rename from protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/JavaBlockingGen.java rename to protoc-gen-restate/src/main/java/dev/restate/sdk/gen/JavaGen.java index e140b883..98bb83f1 100644 --- a/protoc-gen-restate-java-blocking/src/main/java/dev/restate/sdk/blocking/gen/JavaBlockingGen.java +++ b/protoc-gen-restate/src/main/java/dev/restate/sdk/gen/JavaGen.java @@ -6,9 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking.gen; - -import static dev.restate.sdk.blocking.gen.CodeGenUtils.*; +package dev.restate.sdk.gen; import com.google.protobuf.DescriptorProtos; import com.google.protobuf.compiler.PluginProtos; @@ -23,7 +21,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -public class JavaBlockingGen extends Generator { +public class JavaGen extends Generator { @Override protected List supportedFeatures() { @@ -93,15 +91,15 @@ private ServiceContext buildServiceContext( DescriptorProtos.SourceCodeInfo.Location serviceLocation = locations.stream() .filter( - locationPathMatcher( + CodeGenUtils.locationPathMatcher( DescriptorProtos.FileDescriptorProto.SERVICE_FIELD_NUMBER, serviceIndex)) .findFirst() .orElseGet(DescriptorProtos.SourceCodeInfo.Location::getDefaultInstance); serviceContext.javadoc = - getJavadoc( - getComments(serviceLocation), + CodeGenUtils.getJavadoc( + CodeGenUtils.getComments(serviceLocation), serviceProto.getOptions().getDeprecated(), - SERVICE_INDENDATION); + CodeGenUtils.SERVICE_INDENDATION); for (int methodIndex = 0; methodIndex < serviceProto.getMethodCount(); methodIndex++) { serviceContext.methods.add( @@ -118,23 +116,23 @@ private MethodContext buildMethodContext( int serviceIndex, int methodIndex) { MethodContext methodContext = new MethodContext(); - methodContext.methodName = mixedLower(methodProto.getName()); + methodContext.methodName = CodeGenUtils.mixedLower(methodProto.getName()); // This is needed to avoid clashes with generated oneWay and delayed methods. methodContext.topLevelClientMethodName = (methodContext.methodName.equals("oneWay") || methodContext.methodName.equals("delayed")) - ? "call" + firstUppercase(methodContext.methodName) + ? "call" + CodeGenUtils.firstUppercase(methodContext.methodName) : methodContext.methodName; methodContext.inputType = typeMap.toJavaTypeName(methodProto.getInputType()); - methodContext.isInputEmpty = isGoogleProtobufEmpty(methodProto.getInputType()); + methodContext.isInputEmpty = CodeGenUtils.isGoogleProtobufEmpty(methodProto.getInputType()); methodContext.outputType = typeMap.toJavaTypeName(methodProto.getOutputType()); - methodContext.isOutputEmpty = isGoogleProtobufEmpty(methodProto.getOutputType()); + methodContext.isOutputEmpty = CodeGenUtils.isGoogleProtobufEmpty(methodProto.getOutputType()); methodContext.deprecated = methodProto.getOptions().getDeprecated(); // Resolve javadoc DescriptorProtos.SourceCodeInfo.Location serviceLocation = locations.stream() .filter( - locationPathMatcher( + CodeGenUtils.locationPathMatcher( DescriptorProtos.FileDescriptorProto.SERVICE_FIELD_NUMBER, serviceIndex, DescriptorProtos.ServiceDescriptorProto.METHOD_FIELD_NUMBER, @@ -142,10 +140,10 @@ private MethodContext buildMethodContext( .findFirst() .orElseGet(DescriptorProtos.SourceCodeInfo.Location::getDefaultInstance); methodContext.javadoc = - getJavadoc( - getComments(serviceLocation), + CodeGenUtils.getJavadoc( + CodeGenUtils.getComments(serviceLocation), methodProto.getOptions().getDeprecated(), - METHOD_INDENDATION); + CodeGenUtils.METHOD_INDENDATION); return methodContext; } @@ -216,15 +214,15 @@ public String methodNameUpperUnderscore() { } public String methodDescriptorGetter() { - return mixedLower("get_" + methodName + "_method"); + return CodeGenUtils.mixedLower("get_" + methodName + "_method"); } } public static void main(String[] args) { if (args.length == 0) { - ProtocPlugin.generate(List.of(new JavaBlockingGen()), List.of(Ext.serviceType)); + ProtocPlugin.generate(List.of(new JavaGen()), List.of(Ext.serviceType)); } else { - ProtocPlugin.debug(List.of(new JavaBlockingGen()), List.of(Ext.serviceType), args[0]); + ProtocPlugin.debug(List.of(new JavaGen()), List.of(Ext.serviceType), args[0]); } } } diff --git a/protoc-gen-restate-java-blocking/src/main/resources/blockingStub.mustache b/protoc-gen-restate/src/main/resources/blockingStub.mustache similarity index 94% rename from protoc-gen-restate-java-blocking/src/main/resources/blockingStub.mustache rename to protoc-gen-restate/src/main/resources/blockingStub.mustache index f4b26eeb..7cd6ca2c 100644 --- a/protoc-gen-restate-java-blocking/src/main/resources/blockingStub.mustache +++ b/protoc-gen-restate/src/main/resources/blockingStub.mustache @@ -2,9 +2,9 @@ package {{packageName}}; {{/packageName}} -import dev.restate.sdk.blocking.RestateContext; -import dev.restate.sdk.blocking.Awaitable; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.RestateContext; +import dev.restate.sdk.Awaitable; +import dev.restate.sdk.common.syscalls.Syscalls; import java.time.Duration; import static {{packageName}}.{{serviceName}}Grpc.getServiceDescriptor; @@ -93,15 +93,15 @@ public class {{className}} { } {{{javadoc}}} - public static abstract class {{serviceName}}RestateImplBase implements dev.restate.sdk.blocking.RestateBlockingService { + public static abstract class {{serviceName}}RestateImplBase implements dev.restate.sdk.RestateBlockingService { {{#methods}} {{#deprecated}} @java.lang.Deprecated {{/deprecated}} {{{javadoc}}} - public {{#isOutputEmpty}}void{{/isOutputEmpty}}{{^isOutputEmpty}}{{outputType}}{{/isOutputEmpty}} {{methodName}}(RestateContext context{{^isInputEmpty}}, {{inputType}} request{{/isInputEmpty}}) throws dev.restate.sdk.core.TerminalException { - throw new dev.restate.sdk.core.TerminalException(dev.restate.sdk.core.TerminalException.Code.UNIMPLEMENTED); + public {{#isOutputEmpty}}void{{/isOutputEmpty}}{{^isOutputEmpty}}{{outputType}}{{/isOutputEmpty}} {{methodName}}(RestateContext context{{^isInputEmpty}}, {{inputType}} request{{/isInputEmpty}}) throws dev.restate.sdk.common.TerminalException { + throw new dev.restate.sdk.common.TerminalException(dev.restate.sdk.common.TerminalException.Code.UNIMPLEMENTED); } {{/methods}} diff --git a/sdk-api-common/build.gradle.kts b/sdk-api-common/build.gradle.kts new file mode 100644 index 00000000..6b2eea45 --- /dev/null +++ b/sdk-api-common/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + `java-library` + `library-publishing-conventions` +} + +description = "Common interfaces of the Restate SDK" + +dependencies { + api(coreLibs.protobuf.java) + api(coreLibs.grpc.api) + + testImplementation(testingLibs.junit.jupiter) + testImplementation(testingLibs.assertj) +} diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/AbortedExecutionException.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java similarity index 96% rename from sdk-core/src/main/java/dev/restate/sdk/core/AbortedExecutionException.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java index b5887272..80167f3d 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/AbortedExecutionException.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; /** You MUST NOT catch this exception. */ public final class AbortedExecutionException extends Throwable { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/BindableBlockingService.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java similarity index 93% rename from sdk-core/src/main/java/dev/restate/sdk/core/BindableBlockingService.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java index 1370ea7e..8c448d78 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/BindableBlockingService.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import io.grpc.BindableService; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/BindableNonBlockingService.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java similarity index 93% rename from sdk-core/src/main/java/dev/restate/sdk/core/BindableNonBlockingService.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java index b43ffb0e..0e75ba1a 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/BindableNonBlockingService.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import io.grpc.BindableService; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/CoreSerdes.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java similarity index 99% rename from sdk-core/src/main/java/dev/restate/sdk/core/CoreSerdes.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java index 7e5baa21..39bebfdf 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/CoreSerdes.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationId.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/InvocationId.java similarity index 96% rename from sdk-core/src/main/java/dev/restate/sdk/core/InvocationId.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/InvocationId.java index 75448ad6..83c46206 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationId.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/InvocationId.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import io.grpc.Context; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/Serde.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/Serde.java similarity index 94% rename from sdk-core/src/main/java/dev/restate/sdk/core/Serde.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/Serde.java index 43d1de92..1e969458 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/Serde.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/Serde.java @@ -6,11 +6,11 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import com.google.protobuf.ByteString; import com.google.protobuf.UnsafeByteOperations; -import dev.restate.sdk.core.function.ThrowingFunction; +import dev.restate.sdk.common.function.ThrowingFunction; import java.util.Objects; import javax.annotation.Nullable; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/StateKey.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/StateKey.java similarity index 97% rename from sdk-core/src/main/java/dev/restate/sdk/core/StateKey.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/StateKey.java index 045258c9..0855ca7e 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/StateKey.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/StateKey.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; /** * This class holds information about state's name and its type tag to be used for serializing and diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/TerminalException.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/TerminalException.java similarity index 98% rename from sdk-core/src/main/java/dev/restate/sdk/core/TerminalException.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/TerminalException.java index ff1db9ab..3d57b1f0 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/TerminalException.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/TerminalException.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; /** When thrown in a Restate service method, it will complete the invocation with an error. */ public class TerminalException extends RuntimeException { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingFunction.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java similarity index 96% rename from sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingFunction.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java index b4352580..032adeac 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingFunction.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.function; +package dev.restate.sdk.common.function; import java.util.function.Function; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingRunnable.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java similarity index 92% rename from sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingRunnable.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java index 07ca0c72..8f95b42c 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingRunnable.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.function; +package dev.restate.sdk.common.function; /** Like {@link Runnable} but can throw checked exceptions. */ @FunctionalInterface diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingSupplier.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java similarity index 93% rename from sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingSupplier.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java index 900030b7..775bc5d0 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/function/ThrowingSupplier.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.function; +package dev.restate.sdk.common.function; /** Like {@link java.util.function.Supplier} but can throw checked exceptions. */ @FunctionalInterface diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/DeferredResult.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java similarity index 95% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/DeferredResult.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java index c85f621f..f6340a54 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/DeferredResult.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; import javax.annotation.Nullable; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/EnterSideEffectSyscallCallback.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java similarity index 91% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/EnterSideEffectSyscallCallback.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java index ddcd64a7..9559e0b4 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/EnterSideEffectSyscallCallback.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; public interface EnterSideEffectSyscallCallback extends ExitSideEffectSyscallCallback { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ExitSideEffectSyscallCallback.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java similarity index 85% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ExitSideEffectSyscallCallback.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java index 505d2f3b..1f590a37 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ExitSideEffectSyscallCallback.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java @@ -6,10 +6,10 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; import com.google.protobuf.ByteString; -import dev.restate.sdk.core.TerminalException; +import dev.restate.sdk.common.TerminalException; public interface ExitSideEffectSyscallCallback extends SyscallCallback { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResult.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java similarity index 92% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResult.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java index 3f448727..4f646ab1 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResult.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; -import dev.restate.sdk.core.TerminalException; +import dev.restate.sdk.common.TerminalException; import java.util.function.Function; import javax.annotation.Nullable; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResultHolder.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java similarity index 97% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResultHolder.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java index 9ad58505..af698d0f 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/ReadyResultHolder.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; import java.util.function.Function; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/SyscallCallback.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java similarity index 98% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/SyscallCallback.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java index 8a3d835c..ce1b22c2 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/SyscallCallback.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/Syscalls.java b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java similarity index 97% rename from sdk-core/src/main/java/dev/restate/sdk/core/syscalls/Syscalls.java rename to sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java index d88e04a9..e5e50258 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/syscalls/Syscalls.java +++ b/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java @@ -6,11 +6,11 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.syscalls; +package dev.restate.sdk.common.syscalls; import com.google.protobuf.ByteString; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.TerminalException; +import dev.restate.sdk.common.TerminalException; import io.grpc.Context; import io.grpc.MethodDescriptor; import java.time.Duration; diff --git a/sdk-core-impl/src/main/service-protocol/.github/workflows/lint.yaml b/sdk-api-common/src/main/proto/.github/workflows/lint.yaml similarity index 100% rename from sdk-core-impl/src/main/service-protocol/.github/workflows/lint.yaml rename to sdk-api-common/src/main/proto/.github/workflows/lint.yaml diff --git a/sdk-core-impl/src/main/service-protocol/.gitignore b/sdk-api-common/src/main/proto/.gitignore similarity index 100% rename from sdk-core-impl/src/main/service-protocol/.gitignore rename to sdk-api-common/src/main/proto/.gitignore diff --git a/sdk-core/src/main/proto/.protolint.yaml b/sdk-api-common/src/main/proto/.protolint.yaml similarity index 100% rename from sdk-core/src/main/proto/.protolint.yaml rename to sdk-api-common/src/main/proto/.protolint.yaml diff --git a/sdk-core-impl/src/main/service-protocol/LICENSE b/sdk-api-common/src/main/proto/LICENSE similarity index 100% rename from sdk-core-impl/src/main/service-protocol/LICENSE rename to sdk-api-common/src/main/proto/LICENSE diff --git a/sdk-core/src/main/proto/README.md b/sdk-api-common/src/main/proto/README.md similarity index 100% rename from sdk-core/src/main/proto/README.md rename to sdk-api-common/src/main/proto/README.md diff --git a/sdk-core/src/main/proto/buf.yaml b/sdk-api-common/src/main/proto/buf.yaml similarity index 100% rename from sdk-core/src/main/proto/buf.yaml rename to sdk-api-common/src/main/proto/buf.yaml diff --git a/sdk-core/src/main/proto/dev/restate/events.proto b/sdk-api-common/src/main/proto/dev/restate/events.proto similarity index 77% rename from sdk-core/src/main/proto/dev/restate/events.proto rename to sdk-api-common/src/main/proto/dev/restate/events.proto index e69fcf96..f76460a8 100644 --- a/sdk-core/src/main/proto/dev/restate/events.proto +++ b/sdk-api-common/src/main/proto/dev/restate/events.proto @@ -1,12 +1,11 @@ // Copyright (c) 2023 - Restate Software, Inc., Restate GmbH // -// This file is part of the Restate service protocol, which is -// released under the MIT license. +// This file is part of the Restate Java SDK, +// which is released under the MIT license. // // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at -// https://github.com/restatedev/proto/blob/main/LICENSE - +// https://github.com/restatedev/sdk-java/blob/main/LICENSE syntax = "proto3"; package dev.restate; diff --git a/sdk-core/src/main/proto/dev/restate/ext.proto b/sdk-api-common/src/main/proto/dev/restate/ext.proto similarity index 90% rename from sdk-core/src/main/proto/dev/restate/ext.proto rename to sdk-api-common/src/main/proto/dev/restate/ext.proto index ed358f72..ba2d7a19 100644 --- a/sdk-core/src/main/proto/dev/restate/ext.proto +++ b/sdk-api-common/src/main/proto/dev/restate/ext.proto @@ -1,12 +1,11 @@ // Copyright (c) 2023 - Restate Software, Inc., Restate GmbH // -// This file is part of the Restate service protocol, which is -// released under the MIT license. +// This file is part of the Restate Java SDK, +// which is released under the MIT license. // // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at -// https://github.com/restatedev/proto/blob/main/LICENSE - +// https://github.com/restatedev/sdk-java/blob/main/LICENSE syntax = "proto3"; // Restate extensions. diff --git a/sdk-core/src/main/proto/dev/restate/services.proto b/sdk-api-common/src/main/proto/dev/restate/services.proto similarity index 93% rename from sdk-core/src/main/proto/dev/restate/services.proto rename to sdk-api-common/src/main/proto/dev/restate/services.proto index 02853341..856cb2f7 100644 --- a/sdk-core/src/main/proto/dev/restate/services.proto +++ b/sdk-api-common/src/main/proto/dev/restate/services.proto @@ -1,12 +1,11 @@ // Copyright (c) 2023 - Restate Software, Inc., Restate GmbH // -// This file is part of the Restate service protocol, which is -// released under the MIT license. +// This file is part of the Restate Java SDK, +// which is released under the MIT license. // // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at -// https://github.com/restatedev/proto/blob/main/LICENSE - +// https://github.com/restatedev/sdk-java/blob/main/LICENSE syntax = "proto3"; // Restate built-in services. diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/CoreSerdesTest.java b/sdk-api-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java similarity index 98% rename from sdk-core/src/test/java/dev/restate/sdk/core/CoreSerdesTest.java rename to sdk-api-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java index d66a5b32..55adb12d 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/CoreSerdesTest.java +++ b/sdk-api-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.common; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk-kotlin/build.gradle.kts b/sdk-api-kotlin/build.gradle.kts similarity index 83% rename from sdk-kotlin/build.gradle.kts rename to sdk-api-kotlin/build.gradle.kts index 6b4b4e47..9830520c 100644 --- a/sdk-kotlin/build.gradle.kts +++ b/sdk-api-kotlin/build.gradle.kts @@ -6,14 +6,14 @@ plugins { `library-publishing-conventions` } -description = "Restate SDK Kotlin interface" +description = "Restate SDK Kotlin APIs" dependencies { - api(project(":sdk-core")) + api(project(":sdk-api-common")) implementation(kotlinLibs.kotlinx.coroutines) - testImplementation(project(":sdk-core-impl")) + testImplementation(project(":sdk-core")) testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) testImplementation(coreLibs.protobuf.java) @@ -23,8 +23,8 @@ dependencies { testImplementation(coreLibs.grpc.kotlin.stub) testImplementation(coreLibs.log4j.core) - testImplementation(project(":sdk-core-impl", "testArchive")) - testProtobuf(project(":sdk-core-impl", "testArchive")) + testImplementation(project(":sdk-core", "testArchive")) + testProtobuf(project(":sdk-core", "testArchive")) } protobuf { diff --git a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt similarity index 96% rename from sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt rename to sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt index bcebcf19..8960ebc3 100644 --- a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Awaitables.kt @@ -9,10 +9,10 @@ package dev.restate.sdk.kotlin import com.google.protobuf.ByteString -import dev.restate.sdk.core.Serde -import dev.restate.sdk.core.syscalls.DeferredResult -import dev.restate.sdk.core.syscalls.ReadyResultHolder -import dev.restate.sdk.core.syscalls.Syscalls +import dev.restate.sdk.common.Serde +import dev.restate.sdk.common.syscalls.DeferredResult +import dev.restate.sdk.common.syscalls.ReadyResultHolder +import dev.restate.sdk.common.syscalls.Syscalls import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.suspendCancellableCoroutine diff --git a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt similarity index 94% rename from sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt rename to sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt index 000b2db8..3d52c8e4 100644 --- a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/RestateContextImpl.kt @@ -9,11 +9,13 @@ package dev.restate.sdk.kotlin import com.google.protobuf.ByteString -import dev.restate.sdk.core.* -import dev.restate.sdk.core.syscalls.DeferredResult -import dev.restate.sdk.core.syscalls.EnterSideEffectSyscallCallback -import dev.restate.sdk.core.syscalls.ExitSideEffectSyscallCallback -import dev.restate.sdk.core.syscalls.Syscalls +import dev.restate.sdk.common.Serde +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.common.TerminalException +import dev.restate.sdk.common.syscalls.DeferredResult +import dev.restate.sdk.common.syscalls.EnterSideEffectSyscallCallback +import dev.restate.sdk.common.syscalls.ExitSideEffectSyscallCallback +import dev.restate.sdk.common.syscalls.Syscalls import io.grpc.MethodDescriptor import java.lang.Error import kotlin.coroutines.resume diff --git a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt similarity index 91% rename from sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt rename to sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt index 9ac00be9..148e32f8 100644 --- a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/Util.kt @@ -9,9 +9,9 @@ package dev.restate.sdk.kotlin import com.google.protobuf.ByteString -import dev.restate.sdk.core.Serde -import dev.restate.sdk.core.syscalls.SyscallCallback -import dev.restate.sdk.core.syscalls.Syscalls +import dev.restate.sdk.common.Serde +import dev.restate.sdk.common.syscalls.SyscallCallback +import dev.restate.sdk.common.syscalls.Syscalls import kotlin.coroutines.resume import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.CancellationException diff --git a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt similarity index 98% rename from sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt rename to sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt index ca6db137..522558cb 100644 --- a/sdk-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.BindableNonBlockingService -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.Serde -import dev.restate.sdk.core.StateKey -import dev.restate.sdk.core.syscalls.Syscalls +import dev.restate.sdk.common.BindableNonBlockingService +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.common.Serde +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.common.syscalls.Syscalls import io.grpc.MethodDescriptor import java.util.* import kotlin.time.Duration diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt similarity index 72% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt index e497c886..4c3072f4 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/AwakeableIdTest.kt @@ -8,12 +8,12 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.impl.AwakeableIdTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.core.AwakeableIdTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt similarity index 96% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt index b2d32678..a2abf195 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/DeferredTest.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.StateKey -import dev.restate.sdk.core.impl.DeferredTestSuite -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition -import dev.restate.sdk.core.impl.testservices.* +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.core.DeferredTestSuite +import dev.restate.sdk.core.TestDefinitions.TestDefinition +import dev.restate.sdk.core.testservices.* import io.grpc.BindableService import java.util.stream.Stream import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt similarity index 87% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt index 7818183c..a464944e 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/EagerStateTest.kt @@ -8,13 +8,13 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.StateKey -import dev.restate.sdk.core.impl.EagerStateTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.core.EagerStateTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlinx.coroutines.Dispatchers import org.assertj.core.api.AssertionsForClassTypes.assertThat diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt similarity index 71% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt index 39dd9f0f..f31f6d67 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/InvocationIdTest.kt @@ -8,12 +8,12 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.InvocationId -import dev.restate.sdk.core.impl.InvocationIdTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.common.InvocationId +import dev.restate.sdk.core.InvocationIdTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt similarity index 78% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt index ead2ed2e..66574997 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/KotlinCoroutinesTests.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.impl.MockMultiThreaded -import dev.restate.sdk.core.impl.MockSingleThread -import dev.restate.sdk.core.impl.TestDefinitions -import dev.restate.sdk.core.impl.TestDefinitions.TestExecutor -import dev.restate.sdk.core.impl.TestRunner +import dev.restate.sdk.core.MockMultiThreaded +import dev.restate.sdk.core.MockSingleThread +import dev.restate.sdk.core.TestDefinitions +import dev.restate.sdk.core.TestDefinitions.TestExecutor +import dev.restate.sdk.core.TestRunner import java.util.stream.Stream class KotlinCoroutinesTests : TestRunner() { diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt similarity index 74% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt index 3b64bb5a..2b89fef5 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/OnlyInputAndOutputTest.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.impl.OnlyInputAndOutputTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.core.OnlyInputAndOutputTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt similarity index 95% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt index af14eb31..59ed6e2b 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SideEffectTest.kt @@ -8,9 +8,9 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.impl.SideEffectTestSuite -import dev.restate.sdk.core.impl.testservices.* +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.core.SideEffectTestSuite +import dev.restate.sdk.core.testservices.* import io.grpc.BindableService import java.util.* import kotlinx.coroutines.CoroutineName diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt similarity index 83% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt index b1763361..45fe72db 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/SleepTest.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.impl.SleepTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.core.SleepTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt similarity index 83% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt index 7e230d79..908b06d9 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateMachineFailuresTest.kt @@ -8,14 +8,14 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.Serde -import dev.restate.sdk.core.StateKey -import dev.restate.sdk.core.TerminalException -import dev.restate.sdk.core.impl.StateMachineFailuresTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.common.Serde +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.common.TerminalException +import dev.restate.sdk.core.StateMachineFailuresTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import java.nio.charset.StandardCharsets import java.util.concurrent.atomic.AtomicInteger diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt similarity index 81% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt index 9c9dcb73..e860cda4 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/StateTest.kt @@ -8,13 +8,13 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.CoreSerdes -import dev.restate.sdk.core.StateKey -import dev.restate.sdk.core.impl.StateTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.common.CoreSerdes +import dev.restate.sdk.common.StateKey +import dev.restate.sdk.core.StateTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import io.grpc.BindableService import kotlinx.coroutines.Dispatchers diff --git a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt similarity index 91% rename from sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt rename to sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt index e510bd28..4736b035 100644 --- a/sdk-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt +++ b/sdk-api-kotlin/src/test/kotlin/dev/restate/sdk/kotlin/UserFailuresTest.kt @@ -8,11 +8,11 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.kotlin -import dev.restate.sdk.core.TerminalException -import dev.restate.sdk.core.impl.UserFailuresTestSuite -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse +import dev.restate.sdk.common.TerminalException +import dev.restate.sdk.core.UserFailuresTestSuite +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse import io.grpc.BindableService import java.util.concurrent.atomic.AtomicInteger import kotlin.coroutines.cancellation.CancellationException diff --git a/sdk-java-blocking/build.gradle.kts b/sdk-api/build.gradle.kts similarity index 71% rename from sdk-java-blocking/build.gradle.kts rename to sdk-api/build.gradle.kts index 7b42e632..2b1f3bb9 100644 --- a/sdk-java-blocking/build.gradle.kts +++ b/sdk-api/build.gradle.kts @@ -5,14 +5,14 @@ plugins { `library-publishing-conventions` } -description = "Restate SDK Java blocking interface" +description = "Restate SDK APIs" dependencies { - api(project(":sdk-core")) + api(project(":sdk-api-common")) testCompileOnly(coreLibs.javax.annotation.api) - testImplementation(project(":sdk-core-impl")) + testImplementation(project(":sdk-core")) testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) testImplementation(coreLibs.protobuf.java) @@ -20,14 +20,14 @@ dependencies { testImplementation(coreLibs.grpc.protobuf) testImplementation(coreLibs.log4j.core) - // Import test suites from sdk-core-impl - testImplementation(project(":sdk-core-impl", "testArchive")) - testProtobuf(project(":sdk-core-impl", "testArchive")) + // Import test suites from sdk-core + testImplementation(project(":sdk-core", "testArchive")) + testProtobuf(project(":sdk-core", "testArchive")) } val pluginJar = file( - "${project.rootProject.rootDir}/protoc-gen-restate-java-blocking/build/libs/protoc-gen-restate-java-blocking-${project.version}-all.jar") + "${project.rootProject.rootDir}/protoc-gen-restate/build/libs/protoc-gen-restate-${project.version}-all.jar") protobuf { plugins { @@ -41,8 +41,8 @@ protobuf { generateProtoTasks { ofSourceSet("test").forEach { - // Make sure we depend on shadowJar from protoc-gen-restate-java-blocking - it.dependsOn(":protoc-gen-restate-java-blocking:shadowJar") + // Make sure we depend on shadowJar from protoc-gen-restate + it.dependsOn(":protoc-gen-restate:shadowJar") it.plugins { id("grpc") diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AnyAwaitable.java b/sdk-api/src/main/java/dev/restate/sdk/AnyAwaitable.java similarity index 86% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AnyAwaitable.java rename to sdk-api/src/main/java/dev/restate/sdk/AnyAwaitable.java index e5a60134..3e868997 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AnyAwaitable.java +++ b/sdk-api/src/main/java/dev/restate/sdk/AnyAwaitable.java @@ -6,10 +6,10 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.Syscalls; import java.util.List; public final class AnyAwaitable extends Awaitable { diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awaitable.java b/sdk-api/src/main/java/dev/restate/sdk/Awaitable.java similarity index 92% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awaitable.java rename to sdk-api/src/main/java/dev/restate/sdk/Awaitable.java index bc22a90b..b7967703 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awaitable.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Awaitable.java @@ -6,13 +6,13 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.ReadyResultHolder; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.ReadyResultHolder; +import dev.restate.sdk.common.syscalls.Syscalls; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awakeable.java b/sdk-api/src/main/java/dev/restate/sdk/Awakeable.java similarity index 90% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awakeable.java rename to sdk-api/src/main/java/dev/restate/sdk/Awakeable.java index cee7351e..510f1894 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Awakeable.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Awakeable.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; import com.google.protobuf.ByteString; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.Syscalls; import javax.annotation.concurrent.NotThreadSafe; /** diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AwakeableHandle.java b/sdk-api/src/main/java/dev/restate/sdk/AwakeableHandle.java similarity index 93% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AwakeableHandle.java rename to sdk-api/src/main/java/dev/restate/sdk/AwakeableHandle.java index 5009a90d..bc5527cb 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/AwakeableHandle.java +++ b/sdk-api/src/main/java/dev/restate/sdk/AwakeableHandle.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.Serde; +import dev.restate.sdk.common.Serde; import javax.annotation.Nonnull; /** This class represents a handle to an {@link Awakeable} created in another service. */ diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/GrpcChannelAdapter.java b/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java similarity index 98% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/GrpcChannelAdapter.java rename to sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java index 8d9ea9a2..9544c018 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/GrpcChannelAdapter.java +++ b/sdk-api/src/main/java/dev/restate/sdk/GrpcChannelAdapter.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; import io.grpc.*; import java.util.Objects; diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateBlockingService.java b/sdk-api/src/main/java/dev/restate/sdk/RestateBlockingService.java similarity index 75% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateBlockingService.java rename to sdk-api/src/main/java/dev/restate/sdk/RestateBlockingService.java index 6943cbab..947495b3 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateBlockingService.java +++ b/sdk-api/src/main/java/dev/restate/sdk/RestateBlockingService.java @@ -6,10 +6,11 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.BindableBlockingService; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.BindableBlockingService; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.Syscalls; /** * Marker interface for Restate blocking services. @@ -21,8 +22,8 @@ * The error handling of Restate services works as follows: * *
    - *
  • When throwing {@link dev.restate.sdk.core.TerminalException}, the failure will be used as - * invocation response error value + *
  • When throwing {@link TerminalException}, the failure will be used as invocation response + * error value *
  • When throwing any other type of exception, the failure is considered "non-terminal" and the * runtime will retry it, according to its configuration *
diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContext.java b/sdk-api/src/main/java/dev/restate/sdk/RestateContext.java similarity index 97% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContext.java rename to sdk-api/src/main/java/dev/restate/sdk/RestateContext.java index 2b968c76..22bf1535 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContext.java +++ b/sdk-api/src/main/java/dev/restate/sdk/RestateContext.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.*; -import dev.restate.sdk.core.function.ThrowingRunnable; -import dev.restate.sdk.core.function.ThrowingSupplier; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.*; +import dev.restate.sdk.common.function.ThrowingRunnable; +import dev.restate.sdk.common.function.ThrowingSupplier; +import dev.restate.sdk.common.syscalls.Syscalls; import io.grpc.Channel; import io.grpc.MethodDescriptor; import java.time.Duration; diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContextImpl.java b/sdk-api/src/main/java/dev/restate/sdk/RestateContextImpl.java similarity index 91% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContextImpl.java rename to sdk-api/src/main/java/dev/restate/sdk/RestateContextImpl.java index feb66a0e..525c0976 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/RestateContextImpl.java +++ b/sdk-api/src/main/java/dev/restate/sdk/RestateContextImpl.java @@ -6,15 +6,18 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; import com.google.protobuf.ByteString; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.function.ThrowingSupplier; -import dev.restate.sdk.core.syscalls.*; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.function.ThrowingSupplier; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.EnterSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.ExitSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.Syscalls; import io.grpc.MethodDescriptor; import java.time.Duration; import java.util.Map; diff --git a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Util.java b/sdk-api/src/main/java/dev/restate/sdk/Util.java similarity index 88% rename from sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Util.java rename to sdk-api/src/main/java/dev/restate/sdk/Util.java index a9babeb1..aacab935 100644 --- a/sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/Util.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Util.java @@ -6,15 +6,15 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; import com.google.protobuf.ByteString; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.ReadyResult; -import dev.restate.sdk.core.syscalls.SyscallCallback; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.ReadyResult; +import dev.restate.sdk.common.syscalls.SyscallCallback; +import dev.restate.sdk.common.syscalls.Syscalls; import java.util.Optional; import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/AwakeableIdTest.java b/sdk-api/src/test/java/dev/restate/sdk/AwakeableIdTest.java similarity index 71% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/AwakeableIdTest.java rename to sdk-api/src/test/java/dev/restate/sdk/AwakeableIdTest.java index cd87117b..e1bd3f49 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/AwakeableIdTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/AwakeableIdTest.java @@ -6,15 +6,15 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.impl.AwakeableIdTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.core.AwakeableIdTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/DeferredTest.java b/sdk-api/src/test/java/dev/restate/sdk/DeferredTest.java similarity index 93% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/DeferredTest.java rename to sdk-api/src/test/java/dev/restate/sdk/DeferredTest.java index 24235049..093dc9f2 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/DeferredTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/DeferredTest.java @@ -6,17 +6,17 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingRequest; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.ProtoUtils.greetingRequest; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.impl.DeferredTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.core.DeferredTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; import java.time.Duration; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/EagerStateTest.java b/sdk-api/src/test/java/dev/restate/sdk/EagerStateTest.java similarity index 90% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/EagerStateTest.java rename to sdk-api/src/test/java/dev/restate/sdk/EagerStateTest.java index 4b41cfb6..ae178f6e 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/EagerStateTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/EagerStateTest.java @@ -6,16 +6,16 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; import static org.assertj.core.api.Assertions.assertThat; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.impl.EagerStateTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.core.EagerStateTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/GrpcChannelAdapterTest.java b/sdk-api/src/test/java/dev/restate/sdk/GrpcChannelAdapterTest.java similarity index 87% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/GrpcChannelAdapterTest.java rename to sdk-api/src/test/java/dev/restate/sdk/GrpcChannelAdapterTest.java index 9719fea3..091953a3 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/GrpcChannelAdapterTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/GrpcChannelAdapterTest.java @@ -6,17 +6,17 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; -import dev.restate.sdk.core.impl.TestDefinitions; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.TestDefinitions; +import dev.restate.sdk.core.TestDefinitions.TestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.stub.StreamObserver; import java.util.concurrent.ExecutionException; import java.util.stream.Stream; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/InvocationIdTest.java b/sdk-api/src/test/java/dev/restate/sdk/InvocationIdTest.java similarity index 70% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/InvocationIdTest.java rename to sdk-api/src/test/java/dev/restate/sdk/InvocationIdTest.java index 8b6629ce..3624be6b 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/InvocationIdTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/InvocationIdTest.java @@ -6,15 +6,15 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; -import dev.restate.sdk.core.InvocationId; -import dev.restate.sdk.core.impl.InvocationIdTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.InvocationId; +import dev.restate.sdk.core.InvocationIdTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/JavaBlockingTests.java b/sdk-api/src/test/java/dev/restate/sdk/JavaBlockingTests.java similarity index 77% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/JavaBlockingTests.java rename to sdk-api/src/test/java/dev/restate/sdk/JavaBlockingTests.java index 3ce85d62..7ff33e5c 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/JavaBlockingTests.java +++ b/sdk-api/src/test/java/dev/restate/sdk/JavaBlockingTests.java @@ -6,13 +6,13 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.impl.MockMultiThreaded; -import dev.restate.sdk.core.impl.MockSingleThread; -import dev.restate.sdk.core.impl.TestDefinitions.TestExecutor; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.TestRunner; +import dev.restate.sdk.core.MockMultiThreaded; +import dev.restate.sdk.core.MockSingleThread; +import dev.restate.sdk.core.TestDefinitions.TestExecutor; +import dev.restate.sdk.core.TestDefinitions.TestSuite; +import dev.restate.sdk.core.TestRunner; import java.util.stream.Stream; public class JavaBlockingTests extends TestRunner { diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/OnlyInputAndOutputTest.java b/sdk-api/src/test/java/dev/restate/sdk/OnlyInputAndOutputTest.java similarity index 77% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/OnlyInputAndOutputTest.java rename to sdk-api/src/test/java/dev/restate/sdk/OnlyInputAndOutputTest.java index 67092c7a..3002a4e8 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/OnlyInputAndOutputTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/OnlyInputAndOutputTest.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.impl.OnlyInputAndOutputTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.OnlyInputAndOutputTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/RestateCodegenTest.java b/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java similarity index 97% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/RestateCodegenTest.java rename to sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java index b5af1f94..b125d964 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/RestateCodegenTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/RestateCodegenTest.java @@ -6,16 +6,16 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.type; import com.google.protobuf.Empty; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.testservices.*; +import dev.restate.sdk.core.testservices.*; import java.time.Duration; import java.util.stream.Stream; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SideEffectTest.java b/sdk-api/src/test/java/dev/restate/sdk/SideEffectTest.java similarity index 90% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SideEffectTest.java rename to sdk-api/src/test/java/dev/restate/sdk/SideEffectTest.java index c57db8a9..99f812df 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SideEffectTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/SideEffectTest.java @@ -6,15 +6,15 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingRequest; +import static dev.restate.sdk.core.ProtoUtils.greetingRequest; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.impl.SideEffectTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.core.SideEffectTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; import java.util.Objects; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SleepTest.java b/sdk-api/src/test/java/dev/restate/sdk/SleepTest.java similarity index 87% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SleepTest.java rename to sdk-api/src/test/java/dev/restate/sdk/SleepTest.java index feaa5786..f375e408 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/SleepTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/SleepTest.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import dev.restate.sdk.core.impl.SleepTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.SleepTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; import java.time.Duration; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateMachineFailuresTest.java b/sdk-api/src/test/java/dev/restate/sdk/StateMachineFailuresTest.java similarity index 83% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateMachineFailuresTest.java rename to sdk-api/src/test/java/dev/restate/sdk/StateMachineFailuresTest.java index b1e0afff..9294c9ef 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateMachineFailuresTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/StateMachineFailuresTest.java @@ -6,18 +6,18 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.impl.StateMachineFailuresTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.core.StateMachineFailuresTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; import java.nio.charset.StandardCharsets; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateTest.java b/sdk-api/src/test/java/dev/restate/sdk/StateTest.java similarity index 85% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateTest.java rename to sdk-api/src/test/java/dev/restate/sdk/StateTest.java index 8d84e715..700ceb80 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/StateTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/StateTest.java @@ -6,17 +6,17 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; +package dev.restate.sdk; -import static dev.restate.sdk.core.impl.ProtoUtils.greetingResponse; +import static dev.restate.sdk.core.ProtoUtils.greetingResponse; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.impl.StateTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.core.StateTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; diff --git a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/UserFailuresTest.java b/sdk-api/src/test/java/dev/restate/sdk/UserFailuresTest.java similarity index 87% rename from sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/UserFailuresTest.java rename to sdk-api/src/test/java/dev/restate/sdk/UserFailuresTest.java index 2eb6a06c..b257bb9f 100644 --- a/sdk-java-blocking/src/test/java/dev/restate/sdk/blocking/UserFailuresTest.java +++ b/sdk-api/src/test/java/dev/restate/sdk/UserFailuresTest.java @@ -6,19 +6,19 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.blocking; - -import static dev.restate.sdk.core.impl.AssertUtils.containsOnlyExactErrorMessage; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; - -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import dev.restate.sdk.core.impl.UserFailuresTestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +package dev.restate.sdk; + +import static dev.restate.sdk.core.AssertUtils.containsOnlyExactErrorMessage; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; + +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.core.TestDefinitions.TestDefinition; +import dev.restate.sdk.core.UserFailuresTestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import io.grpc.stub.StreamObserver; import java.util.concurrent.atomic.AtomicInteger; @@ -124,7 +124,7 @@ protected BindableService sideEffectThrowTerminalException( return new SideEffectThrowTerminalException(code, message); } - // -- Response observer is something specific to the sdk-java-blocking interface + // -- Response observer is something specific to the sdk-java interface private static class ResponseObserverOnErrorTerminalException extends GreeterGrpc.GreeterImplBase implements RestateBlockingService { diff --git a/sdk-core-impl/build.gradle.kts b/sdk-core-impl/build.gradle.kts deleted file mode 100644 index 5019fb82..00000000 --- a/sdk-core-impl/build.gradle.kts +++ /dev/null @@ -1,54 +0,0 @@ -import com.google.protobuf.gradle.id - -plugins { - `java-library` - `library-publishing-conventions` -} - -description = "Implementation of the Restate SDK core" - -sourceSets { main { proto { srcDirs("src/main/sdk-proto", "src/main/service-protocol") } } } - -dependencies { - implementation(project(":sdk-core")) - - implementation(coreLibs.protobuf.java) - implementation(coreLibs.grpc.api) - implementation(coreLibs.grpc.protobuf) - implementation(coreLibs.log4j.api) - - // We don't want a hard-dependency on it - compileOnly(coreLibs.log4j.core) - - implementation(platform(coreLibs.opentelemetry.bom)) - implementation(coreLibs.opentelemetry.api) - implementation(coreLibs.opentelemetry.semconv) - - testCompileOnly(coreLibs.javax.annotation.api) - - testImplementation(testingLibs.junit.jupiter) - testImplementation(testingLibs.assertj) - testImplementation(coreLibs.grpc.stub) - testImplementation(coreLibs.grpc.protobuf) - testImplementation(coreLibs.log4j.core) -} - -protobuf { - plugins { - id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:${coreLibs.versions.grpc.get()}" } - } - - generateProtoTasks { ofSourceSet("test").forEach { it.plugins { id("grpc") } } } -} - -// Generate test jar - -configurations { register("testArchive") } - -tasks.register("testJar") { - archiveClassifier.set("tests") - - from(project.the()["test"].output) -} - -artifacts { add("testArchive", tasks["testJar"]) } diff --git a/sdk-core-impl/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider b/sdk-core-impl/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider deleted file mode 100644 index e6c67159..00000000 --- a/sdk-core-impl/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider +++ /dev/null @@ -1 +0,0 @@ -dev.restate.sdk.core.impl.GrpcContextDataProvider \ No newline at end of file diff --git a/sdk-core/build.gradle.kts b/sdk-core/build.gradle.kts index 925504d7..2e300d80 100644 --- a/sdk-core/build.gradle.kts +++ b/sdk-core/build.gradle.kts @@ -1,14 +1,54 @@ +import com.google.protobuf.gradle.id + plugins { `java-library` `library-publishing-conventions` } -description = "Core interfaces of the Restate SDK" +description = "Restate SDK Core" + +sourceSets { main { proto { srcDirs("src/main/sdk-proto", "src/main/service-protocol") } } } dependencies { - api(coreLibs.protobuf.java) - api(coreLibs.grpc.api) + implementation(project(":sdk-api-common")) + + implementation(coreLibs.protobuf.java) + implementation(coreLibs.grpc.api) + implementation(coreLibs.grpc.protobuf) + implementation(coreLibs.log4j.api) + + // We don't want a hard-dependency on it + compileOnly(coreLibs.log4j.core) + + implementation(platform(coreLibs.opentelemetry.bom)) + implementation(coreLibs.opentelemetry.api) + implementation(coreLibs.opentelemetry.semconv) + + testCompileOnly(coreLibs.javax.annotation.api) testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) + testImplementation(coreLibs.grpc.stub) + testImplementation(coreLibs.grpc.protobuf) + testImplementation(coreLibs.log4j.core) } + +protobuf { + plugins { + id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:${coreLibs.versions.grpc.get()}" } + } + + generateProtoTasks { ofSourceSet("test").forEach { it.plugins { id("grpc") } } } +} + +// Generate test jar + +configurations { register("testArchive") } + +tasks.register("testJar") { + archiveClassifier.set("tests") + + from(project.the()["test"].output) +} + +artifacts { add("testArchive", tasks["testJar"]) } diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/BaseSuspendableCallbackStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/BaseSuspendableCallbackStateMachine.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/BaseSuspendableCallbackStateMachine.java rename to sdk-core/src/main/java/dev/restate/sdk/core/BaseSuspendableCallbackStateMachine.java index b0a1cf2a..0c767aae 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/BaseSuspendableCallbackStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/BaseSuspendableCallbackStateMachine.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import java.util.function.Consumer; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/CallbackHandle.java b/sdk-core/src/main/java/dev/restate/sdk/core/CallbackHandle.java similarity index 96% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/CallbackHandle.java rename to sdk-core/src/main/java/dev/restate/sdk/core/CallbackHandle.java index cb06e096..c01603f8 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/CallbackHandle.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/CallbackHandle.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import java.util.function.Consumer; import javax.annotation.Nullable; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/DeferredResults.java b/sdk-core/src/main/java/dev/restate/sdk/core/DeferredResults.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/DeferredResults.java rename to sdk-core/src/main/java/dev/restate/sdk/core/DeferredResults.java index f524dd2e..d3d75d76 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/DeferredResults.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/DeferredResults.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.DeferredResult; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Entries.java b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java similarity index 99% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Entries.java rename to sdk-core/src/main/java/dev/restate/sdk/core/Entries.java index 716de1ec..379cb8cd 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Entries.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java @@ -6,14 +6,14 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.protobuf.MessageLite; import dev.restate.generated.service.protocol.Protocol; import dev.restate.generated.service.protocol.Protocol.*; -import dev.restate.sdk.core.impl.ReadyResults.ReadyResultInternal; +import dev.restate.sdk.core.ReadyResults.ReadyResultInternal; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.Span; import java.util.function.Function; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExceptionCatchingInvocationInputSubscriber.java b/sdk-core/src/main/java/dev/restate/sdk/core/ExceptionCatchingInvocationInputSubscriber.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExceptionCatchingInvocationInputSubscriber.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ExceptionCatchingInvocationInputSubscriber.java index 850cb854..99c9598d 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExceptionCatchingInvocationInputSubscriber.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ExceptionCatchingInvocationInputSubscriber.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import java.util.concurrent.Flow; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExecutorSwitchingWrappers.java b/sdk-core/src/main/java/dev/restate/sdk/core/ExecutorSwitchingWrappers.java similarity index 94% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExecutorSwitchingWrappers.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ExecutorSwitchingWrappers.java index 75f6f7e6..b5f35c7b 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ExecutorSwitchingWrappers.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ExecutorSwitchingWrappers.java @@ -6,12 +6,16 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.syscalls.*; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.*; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.EnterSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.ExitSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.SyscallCallback; import io.grpc.MethodDescriptor; import java.time.Duration; import java.util.Map; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcContextDataProvider.java b/sdk-core/src/main/java/dev/restate/sdk/core/GrpcContextDataProvider.java similarity index 94% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcContextDataProvider.java rename to sdk-core/src/main/java/dev/restate/sdk/core/GrpcContextDataProvider.java index 4ea4a37e..900257e9 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcContextDataProvider.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/GrpcContextDataProvider.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.InvocationId; +import dev.restate.sdk.common.InvocationId; import java.util.Map; import org.apache.logging.log4j.core.util.ContextDataProvider; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcServerCallListenerAdaptor.java b/sdk-core/src/main/java/dev/restate/sdk/core/GrpcServerCallListenerAdaptor.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcServerCallListenerAdaptor.java rename to sdk-core/src/main/java/dev/restate/sdk/core/GrpcServerCallListenerAdaptor.java index dbfdb217..7eb00de7 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/GrpcServerCallListenerAdaptor.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/GrpcServerCallListenerAdaptor.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import io.grpc.Metadata; import io.grpc.ServerCall; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/IncomingEntriesStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/IncomingEntriesStateMachine.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/IncomingEntriesStateMachine.java rename to sdk-core/src/main/java/dev/restate/sdk/core/IncomingEntriesStateMachine.java index a38a0386..29ace7ad 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/IncomingEntriesStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/IncomingEntriesStateMachine.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import java.util.ArrayDeque; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InputPublisherState.java b/sdk-core/src/main/java/dev/restate/sdk/core/InputPublisherState.java similarity index 89% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InputPublisherState.java rename to sdk-core/src/main/java/dev/restate/sdk/core/InputPublisherState.java index 29784e3f..35507f78 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InputPublisherState.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InputPublisherState.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.AbortedExecutionException; +import dev.restate.sdk.common.AbortedExecutionException; import javax.annotation.Nullable; class InputPublisherState { diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationFlow.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationFlow.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationFlow.java rename to sdk-core/src/main/java/dev/restate/sdk/core/InvocationFlow.java index b16e9484..5c79f314 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationFlow.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationFlow.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import java.util.concurrent.Flow; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationHandler.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationHandler.java similarity index 95% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationHandler.java rename to sdk-core/src/main/java/dev/restate/sdk/core/InvocationHandler.java index 00fd9fce..fea78c22 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationHandler.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationHandler.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; /** * Resolved handler for an invocation. diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationIdImpl.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationIdImpl.java similarity index 91% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationIdImpl.java rename to sdk-core/src/main/java/dev/restate/sdk/core/InvocationIdImpl.java index 7a71ab8a..be6b4c2d 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationIdImpl.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationIdImpl.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.InvocationId; +import dev.restate.sdk.common.InvocationId; import java.util.Objects; final class InvocationIdImpl implements InvocationId { diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java similarity index 88% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationStateMachine.java rename to sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java index 30658cd0..31ba5b98 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/InvocationStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java @@ -6,24 +6,19 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import com.google.protobuf.MessageLite; import com.google.rpc.Code; import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.InvocationId; -import dev.restate.sdk.core.impl.DeferredResults.CombinatorDeferredResult; -import dev.restate.sdk.core.impl.DeferredResults.ResolvableSingleDeferredResult; -import dev.restate.sdk.core.impl.DeferredResults.SingleDeferredResultInternal; -import dev.restate.sdk.core.impl.Entries.JournalEntry; -import dev.restate.sdk.core.impl.ReadyResults.ReadyResultInternal; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.EnterSideEffectSyscallCallback; -import dev.restate.sdk.core.syscalls.ExitSideEffectSyscallCallback; -import dev.restate.sdk.core.syscalls.SyscallCallback; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.InvocationId; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.EnterSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.ExitSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.SyscallCallback; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.Span; import java.util.*; @@ -279,7 +274,7 @@ void processCompletableJournalEntry( // Entry is already completed journalEntry.updateUserStateStoreWithEntry( (E) actualEntryMessage, this.userStateStore); - ReadyResultInternal readyResultInternal = + ReadyResults.ReadyResultInternal readyResultInternal = journalEntry.parseEntryResult((E) actualEntryMessage); callback.onSuccess(DeferredResults.completedSingle(entryIndex, readyResultInternal)); } else { @@ -336,7 +331,9 @@ void processCompletableJournalEntry( @SuppressWarnings("unchecked") void processJournalEntry( - E expectedEntryMessage, JournalEntry journalEntry, SyscallCallback callback) { + E expectedEntryMessage, + Entries.JournalEntry journalEntry, + SyscallCallback callback) { checkInsideSideEffectGuard(); if (this.state == State.CLOSED) { callback.onCancel(AbortedExecutionException.INSTANCE); @@ -454,13 +451,15 @@ void resolveDeferred(DeferredResult deferredToResolve, SyscallCallback) deferredToResolve, callback); + if (deferredToResolve instanceof DeferredResults.ResolvableSingleDeferredResult) { + this.resolveSingleDeferred( + (DeferredResults.ResolvableSingleDeferredResult) deferredToResolve, callback); return; } - if (deferredToResolve instanceof CombinatorDeferredResult) { - this.resolveCombinatorDeferred((CombinatorDeferredResult) deferredToResolve, callback); + if (deferredToResolve instanceof DeferredResults.CombinatorDeferredResult) { + this.resolveCombinatorDeferred( + (DeferredResults.CombinatorDeferredResult) deferredToResolve, callback); return; } @@ -468,14 +467,15 @@ void resolveDeferred(DeferredResult deferredToResolve, SyscallCallback void resolveSingleDeferred( - ResolvableSingleDeferredResult deferred, SyscallCallback callback) { + DeferredResults.ResolvableSingleDeferredResult deferred, SyscallCallback callback) { this.readyResultStateMachine.onNewReadyResult( new ReadyResultStateMachine.OnNewReadyResultCallback() { @SuppressWarnings("unchecked") @Override - public boolean onNewReadyResult(Map> resultMap) { - ReadyResultInternal resolved = - (ReadyResultInternal) resultMap.remove(deferred.entryIndex()); + public boolean onNewReadyResult( + Map> resultMap) { + ReadyResults.ReadyResultInternal resolved = + (ReadyResults.ReadyResultInternal) resultMap.remove(deferred.entryIndex()); if (resolved != null) { deferred.resolve(resolved); callback.onSuccess(null); @@ -499,14 +499,15 @@ public void onError(Throwable e) { /** * This method implements the algorithm to resolve deferred combinator trees, where inner nodes of - * the tree are ANY or ALL combinators, and leafs are {@link ResolvableSingleDeferredResult}, - * created as result of completable syscalls. + * the tree are ANY or ALL combinators, and leafs are {@link + * DeferredResults.ResolvableSingleDeferredResult}, created as result of completable syscalls. * *

The idea of the algorithm is the following: {@code rootDeferred} is the root of this tree, * and has internal state that can be mutated through {@link - * CombinatorDeferredResult#tryResolve(int)} to flag the tree as resolved. Every time a new leaf - * is resolved through {@link ResolvableSingleDeferredResult#resolve(ReadyResultInternal)}, we try - * to resolve the tree again. We start by checking if we have enough resolved leafs in the + * DeferredResults.CombinatorDeferredResult#tryResolve(int)} to flag the tree as resolved. Every + * time a new leaf is resolved through {@link + * DeferredResults.ResolvableSingleDeferredResult#resolve(ReadyResults.ReadyResultInternal)}, we + * try to resolve the tree again. We start by checking if we have enough resolved leafs in the * combinator tree to resolve it. If not, we register a callback to the {@link * ReadyResultStateMachine} to wait on future completions. As soon as the tree is resolved, we * record in the journal the order of the leafs we've seen so far, and we finish by calling the @@ -530,13 +531,13 @@ public void onError(Throwable e) { * the combinator journal entry only when there is a subset of resolved leafs which * completes the combinator tree. Moreover, the leaf journal entries precede the combinator * entry because they are created first. - *

  • In case there are no {@link SingleDeferredResultInternal SingleDeferredResultInternals}, - * it means every leaf has been resolved beforehand. In this case, we must be able to flag - * this combinator tree as resolved as well. + *
  • In case there are no {@link DeferredResults.SingleDeferredResultInternal + * SingleDeferredResultInternals}, it means every leaf has been resolved beforehand. In this + * case, we must be able to flag this combinator tree as resolved as well. * */ private void resolveCombinatorDeferred( - CombinatorDeferredResult rootDeferred, SyscallCallback callback) { + DeferredResults.CombinatorDeferredResult rootDeferred, SyscallCallback callback) { // Calling .await() on a combinator deferred within a side effect is not allowed // as resolving it creates or read a journal entry. checkInsideSideEffectGuard(); @@ -555,9 +556,10 @@ private void resolveCombinatorDeferred( callback::onCancel); } else if (this.state == State.PROCESSING) { // Create map of singles to resolve - Map> resolvableSingles = new HashMap<>(); + Map> resolvableSingles = + new HashMap<>(); - Set> unprocessedLeafs = + Set> unprocessedLeafs = rootDeferred.unprocessedLeafs().collect(Collectors.toSet()); // If there are no leafs, it means the combinator must be resolvable @@ -578,7 +580,7 @@ private void resolveCombinatorDeferred( List resolvedOrder = new ArrayList<>(); // Walk the tree and populate the resolvable singles, and keep the already known ready results - for (SingleDeferredResultInternal singleDeferred : unprocessedLeafs) { + for (DeferredResults.SingleDeferredResultInternal singleDeferred : unprocessedLeafs) { int entryIndex = singleDeferred.entryIndex(); if (singleDeferred.isCompleted()) { resolvedOrder.add(entryIndex); @@ -591,7 +593,8 @@ private void resolveCombinatorDeferred( } } else { // If not completed, then it's a ResolvableSingleDeferredResult - resolvableSingles.put(entryIndex, (ResolvableSingleDeferredResult) singleDeferred); + resolvableSingles.put( + entryIndex, (DeferredResults.ResolvableSingleDeferredResult) singleDeferred); } } @@ -600,17 +603,19 @@ private void resolveCombinatorDeferred( new ReadyResultStateMachine.OnNewReadyResultCallback() { @SuppressWarnings({"unchecked", "rawtypes"}) @Override - public boolean onNewReadyResult(Map> resultMap) { - Iterator>> it = + public boolean onNewReadyResult( + Map> resultMap) { + Iterator>> it = resolvableSingles.entrySet().iterator(); while (it.hasNext()) { - Map.Entry> entry = it.next(); + Map.Entry> entry = + it.next(); int entryIndex = entry.getKey(); - ReadyResultInternal result = resultMap.remove(entryIndex); + ReadyResults.ReadyResultInternal result = resultMap.remove(entryIndex); if (result != null) { resolvedOrder.add(entryIndex); - entry.getValue().resolve((ReadyResultInternal) result); + entry.getValue().resolve((ReadyResults.ReadyResultInternal) result); it.remove(); // Try to resolve the combinator now diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageHeader.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java similarity index 99% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageHeader.java rename to sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java index 587585f8..7a494680 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageHeader.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import dev.restate.generated.sdk.java.Java; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageType.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java similarity index 99% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageType.java rename to sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java index ca849065..b0d07c19 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/MessageType.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import com.google.protobuf.Parser; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ProtocolException.java b/sdk-core/src/main/java/dev/restate/sdk/core/ProtocolException.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ProtocolException.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ProtocolException.java index e61c7867..128e50ef 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ProtocolException.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ProtocolException.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import dev.restate.generated.service.protocol.Protocol; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResultStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/ReadyResultStateMachine.java similarity index 81% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResultStateMachine.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ReadyResultStateMachine.java index 56691dd9..8a251520 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResultStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ReadyResultStateMachine.java @@ -6,10 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.ReadyResults.ReadyResultInternal; import java.util.HashMap; import java.util.Map; import java.util.function.Function; @@ -23,13 +22,14 @@ class ReadyResultStateMachine private static final Logger LOG = LogManager.getLogger(ReadyResultStateMachine.class); interface OnNewReadyResultCallback extends SuspendableCallback { - boolean onNewReadyResult(Map> resultMap); + boolean onNewReadyResult(Map> resultMap); } private final Map completions; - private final Map>> + private final Map< + Integer, Function>> completionParsers; - private final Map> results; + private final Map> results; ReadyResultStateMachine() { this.completions = new HashMap<>(); @@ -45,7 +45,8 @@ void offerCompletion(Protocol.CompletionMessage completionMessage) { } void offerCompletionParser( - int entryIndex, Function> parser) { + int entryIndex, + Function> parser) { LOG.trace("Offered new completion parser for index {}", entryIndex); this.completionParsers.put(entryIndex, parser); @@ -70,7 +71,7 @@ private void tryParse(int entryIndex) { return; } - Function> parser = + Function> parser = this.completionParsers.remove(entryIndex); if (parser == null) { return; @@ -79,7 +80,7 @@ private void tryParse(int entryIndex) { this.completions.remove(entryIndex, completionMessage); // Parse to ready result - ReadyResultInternal readyResult = parser.apply(completionMessage); + ReadyResults.ReadyResultInternal readyResult = parser.apply(completionMessage); // Push to the ready result queue this.results.put(completionMessage.getEntryIndex(), readyResult); diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResults.java b/sdk-core/src/main/java/dev/restate/sdk/core/ReadyResults.java similarity index 95% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResults.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ReadyResults.java index 601bda28..8c264743 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ReadyResults.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ReadyResults.java @@ -6,10 +6,10 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.syscalls.ReadyResult; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.ReadyResult; import java.util.function.Function; import javax.annotation.Nullable; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateGrpcServer.java b/sdk-core/src/main/java/dev/restate/sdk/core/RestateGrpcServer.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateGrpcServer.java rename to sdk-core/src/main/java/dev/restate/sdk/core/RestateGrpcServer.java index 2a5de2e2..17a0f451 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateGrpcServer.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/RestateGrpcServer.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.InvocationId; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.InvocationId; +import dev.restate.sdk.common.syscalls.Syscalls; import io.grpc.*; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCall.java b/sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCall.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCall.java rename to sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCall.java index e79f75d9..c3ac4d70 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCall.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCall.java @@ -6,11 +6,11 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.syscalls.SyscallCallback; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.SyscallCallback; import io.grpc.Metadata; import io.grpc.MethodDescriptor; import io.grpc.ServerCall; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCallListener.java b/sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCallListener.java similarity index 95% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCallListener.java rename to sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCallListener.java index f0f5b973..fb823b95 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/RestateServerCallListener.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/RestateServerCallListener.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; /** * Callbacks for incoming rpc messages. diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandler.java b/sdk-core/src/main/java/dev/restate/sdk/core/ServiceDiscoveryHandler.java similarity index 98% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandler.java rename to sdk-core/src/main/java/dev/restate/sdk/core/ServiceDiscoveryHandler.java index 1dc668c8..7ed21cef 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandler.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/ServiceDiscoveryHandler.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.DescriptorProtos; import com.google.protobuf.Descriptors; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SideEffectAckStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/SideEffectAckStateMachine.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SideEffectAckStateMachine.java rename to sdk-core/src/main/java/dev/restate/sdk/core/SideEffectAckStateMachine.java index 398ac7b5..3fd0ed0d 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SideEffectAckStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SideEffectAckStateMachine.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; /** State machine tracking side effects acks */ class SideEffectAckStateMachine diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SuspendableCallback.java b/sdk-core/src/main/java/dev/restate/sdk/core/SuspendableCallback.java similarity index 92% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SuspendableCallback.java rename to sdk-core/src/main/java/dev/restate/sdk/core/SuspendableCallback.java index 21b4a6c0..8939bb26 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SuspendableCallback.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SuspendableCallback.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; interface SuspendableCallback { diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsImpl.java b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java similarity index 94% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsImpl.java rename to sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java index c8170e5e..26380b1a 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsImpl.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java @@ -6,9 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; - -import static dev.restate.sdk.core.impl.Util.toProtocolFailure; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import com.google.protobuf.MessageLite; @@ -16,14 +14,14 @@ import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; import dev.restate.generated.service.protocol.Protocol.PollInputStreamEntryMessage; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.impl.DeferredResults.SingleDeferredResultInternal; -import dev.restate.sdk.core.impl.Entries.*; -import dev.restate.sdk.core.impl.ReadyResults.ReadyResultInternal; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.EnterSideEffectSyscallCallback; -import dev.restate.sdk.core.syscalls.ExitSideEffectSyscallCallback; -import dev.restate.sdk.core.syscalls.SyscallCallback; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.EnterSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.ExitSideEffectSyscallCallback; +import dev.restate.sdk.common.syscalls.SyscallCallback; +import dev.restate.sdk.core.DeferredResults.SingleDeferredResultInternal; +import dev.restate.sdk.core.Entries.*; +import dev.restate.sdk.core.ReadyResults.ReadyResultInternal; import io.grpc.MethodDescriptor; import java.io.IOException; import java.nio.ByteBuffer; @@ -80,7 +78,7 @@ public void writeOutput(TerminalException throwable, SyscallCallback callb LOG.trace("writeOutput failure"); this.writeOutput( Protocol.OutputStreamEntryMessage.newBuilder() - .setFailure(toProtocolFailure(throwable)) + .setFailure(Util.toProtocolFailure(throwable)) .build(), callback); }, @@ -236,7 +234,7 @@ public void exitSideEffectBlockWithTerminalException( LOG.trace("exitSideEffectBlock with failure"); this.stateMachine.exitSideEffectBlock( Java.SideEffectEntryMessage.newBuilder() - .setFailure(toProtocolFailure(toWrite)) + .setFailure(Util.toProtocolFailure(toWrite)) .build(), callback); }, diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsInternal.java b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsInternal.java similarity index 82% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsInternal.java rename to sdk-core/src/main/java/dev/restate/sdk/core/SyscallsInternal.java index ced86ed0..ee2c5db4 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/SyscallsInternal.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsInternal.java @@ -6,11 +6,11 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import dev.restate.sdk.core.impl.DeferredResults.DeferredResultInternal; -import dev.restate.sdk.core.syscalls.DeferredResult; -import dev.restate.sdk.core.syscalls.Syscalls; +import dev.restate.sdk.common.syscalls.DeferredResult; +import dev.restate.sdk.common.syscalls.Syscalls; +import dev.restate.sdk.core.DeferredResults.DeferredResultInternal; import java.util.List; import java.util.stream.Collectors; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Tracing.java b/sdk-core/src/main/java/dev/restate/sdk/core/Tracing.java similarity index 96% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Tracing.java rename to sdk-core/src/main/java/dev/restate/sdk/core/Tracing.java index 6766e346..1a5f41bb 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Tracing.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Tracing.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import io.opentelemetry.api.common.AttributeKey; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/UserStateStore.java b/sdk-core/src/main/java/dev/restate/sdk/core/UserStateStore.java similarity index 97% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/UserStateStore.java rename to sdk-core/src/main/java/dev/restate/sdk/core/UserStateStore.java index ba223970..fe842d8c 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/UserStateStore.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/UserStateStore.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import java.util.HashMap; diff --git a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Util.java b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java similarity index 96% rename from sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Util.java rename to sdk-core/src/main/java/dev/restate/sdk/core/Util.java index 151fd61a..1ab9f9d4 100644 --- a/sdk-core-impl/src/main/java/dev/restate/sdk/core/impl/Util.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java @@ -6,13 +6,13 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import com.google.protobuf.MessageLite; import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.AbortedExecutionException; -import dev.restate.sdk.core.TerminalException; +import dev.restate.sdk.common.AbortedExecutionException; +import dev.restate.sdk.common.TerminalException; import io.grpc.Status; import java.util.Objects; import java.util.Optional; diff --git a/sdk-core/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider b/sdk-core/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider new file mode 100644 index 00000000..bbed00cc --- /dev/null +++ b/sdk-core/src/main/resources/META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider @@ -0,0 +1 @@ +dev.restate.sdk.core.GrpcContextDataProvider \ No newline at end of file diff --git a/sdk-core-impl/src/main/sdk-proto/dev/restate/sdk/java.proto b/sdk-core/src/main/sdk-proto/dev/restate/sdk/java.proto similarity index 100% rename from sdk-core-impl/src/main/sdk-proto/dev/restate/sdk/java.proto rename to sdk-core/src/main/sdk-proto/dev/restate/sdk/java.proto diff --git a/sdk-core/src/main/proto/.github/workflows/lint.yaml b/sdk-core/src/main/service-protocol/.github/workflows/lint.yaml similarity index 100% rename from sdk-core/src/main/proto/.github/workflows/lint.yaml rename to sdk-core/src/main/service-protocol/.github/workflows/lint.yaml diff --git a/sdk-core/src/main/proto/.gitignore b/sdk-core/src/main/service-protocol/.gitignore similarity index 100% rename from sdk-core/src/main/proto/.gitignore rename to sdk-core/src/main/service-protocol/.gitignore diff --git a/sdk-core-impl/src/main/service-protocol/.prettierrc.toml b/sdk-core/src/main/service-protocol/.prettierrc.toml similarity index 100% rename from sdk-core-impl/src/main/service-protocol/.prettierrc.toml rename to sdk-core/src/main/service-protocol/.prettierrc.toml diff --git a/sdk-core-impl/src/main/service-protocol/.protolint.yaml b/sdk-core/src/main/service-protocol/.protolint.yaml similarity index 100% rename from sdk-core-impl/src/main/service-protocol/.protolint.yaml rename to sdk-core/src/main/service-protocol/.protolint.yaml diff --git a/sdk-core/src/main/proto/LICENSE b/sdk-core/src/main/service-protocol/LICENSE similarity index 100% rename from sdk-core/src/main/proto/LICENSE rename to sdk-core/src/main/service-protocol/LICENSE diff --git a/sdk-core-impl/src/main/service-protocol/README.md b/sdk-core/src/main/service-protocol/README.md similarity index 100% rename from sdk-core-impl/src/main/service-protocol/README.md rename to sdk-core/src/main/service-protocol/README.md diff --git a/sdk-core-impl/src/main/service-protocol/dev/restate/service/discovery.proto b/sdk-core/src/main/service-protocol/dev/restate/service/discovery.proto similarity index 88% rename from sdk-core-impl/src/main/service-protocol/dev/restate/service/discovery.proto rename to sdk-core/src/main/service-protocol/dev/restate/service/discovery.proto index 0b3398b4..290872a3 100644 --- a/sdk-core-impl/src/main/service-protocol/dev/restate/service/discovery.proto +++ b/sdk-core/src/main/service-protocol/dev/restate/service/discovery.proto @@ -1,12 +1,11 @@ // Copyright (c) 2023 - Restate Software, Inc., Restate GmbH // -// This file is part of the Restate service protocol, which is -// released under the MIT license. +// This file is part of the Restate Java SDK, +// which is released under the MIT license. // // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at -// https://github.com/restatedev/service-protocol/blob/main/LICENSE - +// https://github.com/restatedev/sdk-java/blob/main/LICENSE syntax = "proto3"; package dev.restate.service.discovery; diff --git a/sdk-core-impl/src/main/service-protocol/dev/restate/service/protocol.proto b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto similarity index 97% rename from sdk-core-impl/src/main/service-protocol/dev/restate/service/protocol.proto rename to sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto index f86c9b43..f58771b8 100644 --- a/sdk-core-impl/src/main/service-protocol/dev/restate/service/protocol.proto +++ b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto @@ -1,12 +1,11 @@ // Copyright (c) 2023 - Restate Software, Inc., Restate GmbH // -// This file is part of the Restate service protocol, which is -// released under the MIT license. +// This file is part of the Restate Java SDK, +// which is released under the MIT license. // // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at -// https://github.com/restatedev/service-protocol/blob/main/LICENSE - +// https://github.com/restatedev/sdk-java/blob/main/LICENSE syntax = "proto3"; package dev.restate.service.protocol; diff --git a/sdk-core-impl/src/main/service-protocol/service-invocation-protocol.md b/sdk-core/src/main/service-protocol/service-invocation-protocol.md similarity index 100% rename from sdk-core-impl/src/main/service-protocol/service-invocation-protocol.md rename to sdk-core/src/main/service-protocol/service-invocation-protocol.md diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AssertUtils.java b/sdk-core/src/test/java/dev/restate/sdk/core/AssertUtils.java similarity index 98% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AssertUtils.java rename to sdk-core/src/test/java/dev/restate/sdk/core/AssertUtils.java index 0e166df7..c52c9abb 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AssertUtils.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/AssertUtils.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.STRING; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AwakeableIdTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/AwakeableIdTestSuite.java similarity index 85% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AwakeableIdTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/AwakeableIdTestSuite.java index e9daf6d1..117ea6a1 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/AwakeableIdTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/AwakeableIdTestSuite.java @@ -6,21 +6,21 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.inputMessage; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; +import static dev.restate.sdk.core.ProtoUtils.inputMessage; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.type; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.TestDefinitions.TestDefinition; +import dev.restate.sdk.core.TestDefinitions.TestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import java.nio.ByteBuffer; import java.util.Base64; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/DeferredTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/DeferredTestSuite.java similarity index 98% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/DeferredTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/DeferredTestSuite.java index 8360d3ff..c00ee9a2 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/DeferredTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/DeferredTestSuite.java @@ -6,10 +6,10 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.list; import static org.assertj.core.api.InstanceOfAssertFactories.type; @@ -17,8 +17,8 @@ import com.google.protobuf.Empty; import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; import io.grpc.BindableService; import java.util.function.Supplier; import java.util.stream.Stream; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/EagerStateTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/EagerStateTestSuite.java similarity index 96% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/EagerStateTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/EagerStateTestSuite.java index f0ed348a..588c9a21 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/EagerStateTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/EagerStateTestSuite.java @@ -6,14 +6,14 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.AssertionsForClassTypes.entry; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreeterGrpc; import io.grpc.BindableService; import java.util.Map; import java.util.stream.Stream; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/FlowUtils.java b/sdk-core/src/test/java/dev/restate/sdk/core/FlowUtils.java similarity index 99% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/FlowUtils.java rename to sdk-core/src/test/java/dev/restate/sdk/core/FlowUtils.java index 2c0ee2f6..bb41a1b4 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/FlowUtils.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/FlowUtils.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import java.util.*; import java.util.concurrent.CompletableFuture; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/InvocationIdTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/InvocationIdTestSuite.java similarity index 74% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/InvocationIdTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/InvocationIdTestSuite.java index bc8c0124..e404e9de 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/InvocationIdTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/InvocationIdTestSuite.java @@ -6,17 +6,17 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; import com.google.protobuf.ByteString; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; +import dev.restate.sdk.core.TestDefinitions.TestDefinition; +import dev.restate.sdk.core.TestDefinitions.TestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; import io.grpc.BindableService; import java.util.stream.Stream; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockMultiThreaded.java b/sdk-core/src/test/java/dev/restate/sdk/core/MockMultiThreaded.java similarity index 98% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockMultiThreaded.java rename to sdk-core/src/test/java/dev/restate/sdk/core/MockMultiThreaded.java index 36cb7864..9f982fb1 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockMultiThreaded.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/MockMultiThreaded.java @@ -6,7 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockSingleThread.java b/sdk-core/src/test/java/dev/restate/sdk/core/MockSingleThread.java similarity index 93% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockSingleThread.java rename to sdk-core/src/test/java/dev/restate/sdk/core/MockSingleThread.java index a6b80a35..39d88ffc 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/MockSingleThread.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/MockSingleThread.java @@ -6,14 +6,14 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import static org.assertj.core.api.Assertions.assertThat; import com.google.protobuf.MessageLite; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import dev.restate.sdk.core.impl.TestDefinitions.TestExecutor; +import dev.restate.sdk.core.TestDefinitions.TestDefinition; +import dev.restate.sdk.core.TestDefinitions.TestExecutor; import io.grpc.ServerServiceDefinition; import java.time.Duration; import org.apache.logging.log4j.ThreadContext; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/OnlyInputAndOutputTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/OnlyInputAndOutputTestSuite.java similarity index 67% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/OnlyInputAndOutputTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/OnlyInputAndOutputTestSuite.java index eca6968b..5bf8df36 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/OnlyInputAndOutputTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/OnlyInputAndOutputTestSuite.java @@ -6,16 +6,16 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.TestDefinition; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.TestDefinitions.TestSuite; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import java.util.stream.Stream; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ProtoUtils.java b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java similarity index 94% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ProtoUtils.java rename to sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java index aca969c0..1bf118bb 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ProtoUtils.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java @@ -6,9 +6,7 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; - -import static dev.restate.sdk.core.impl.Util.toProtocolFailure; +package dev.restate.sdk.core; import com.google.protobuf.ByteString; import com.google.protobuf.Empty; @@ -17,9 +15,9 @@ import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; import dev.restate.generated.service.protocol.Protocol.StartMessage.StateEntry; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.MethodDescriptor; import java.util.Arrays; import java.util.List; @@ -82,7 +80,7 @@ public static Protocol.CompletionMessage completionMessage( public static Protocol.CompletionMessage completionMessage(int index, Throwable e) { return Protocol.CompletionMessage.newBuilder() .setEntryIndex(index) - .setFailure(toProtocolFailure(e)) + .setFailure(Util.toProtocolFailure(e)) .build(); } @@ -114,7 +112,9 @@ public static Protocol.OutputStreamEntryMessage outputMessage( } public static Protocol.OutputStreamEntryMessage outputMessage(Throwable e) { - return Protocol.OutputStreamEntryMessage.newBuilder().setFailure(toProtocolFailure(e)).build(); + return Protocol.OutputStreamEntryMessage.newBuilder() + .setFailure(Util.toProtocolFailure(e)) + .build(); } public static Protocol.GetStateEntryMessage.Builder getStateMessage(String key) { @@ -163,7 +163,7 @@ Protocol.InvokeEntryMessage invokeMessage( public static Protocol.InvokeEntryMessage invokeMessage( MethodDescriptor methodDescriptor, T parameter, Throwable e) { - return invokeMessage(methodDescriptor, parameter).setFailure(toProtocolFailure(e)).build(); + return invokeMessage(methodDescriptor, parameter).setFailure(Util.toProtocolFailure(e)).build(); } public static diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandlerTest.java b/sdk-core/src/test/java/dev/restate/sdk/core/ServiceDiscoveryHandlerTest.java similarity index 91% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandlerTest.java rename to sdk-core/src/test/java/dev/restate/sdk/core/ServiceDiscoveryHandlerTest.java index 39a24422..f6a7197a 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/ServiceDiscoveryHandlerTest.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ServiceDiscoveryHandlerTest.java @@ -6,14 +6,14 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import static org.assertj.core.api.Assertions.assertThat; import com.google.protobuf.DescriptorProtos; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.impl.testservices.CounterGrpc; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.CounterGrpc; +import dev.restate.sdk.core.testservices.GreeterGrpc; import java.util.Map; import org.junit.jupiter.api.Test; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SideEffectTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java similarity index 85% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SideEffectTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java index 013168e8..04e022d9 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SideEffectTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java @@ -6,24 +6,23 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.AssertUtils.containsOnlyExactErrorMessage; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; -import static org.assertj.core.api.Assertions.assertThat; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.InstanceOfAssertFactories.type; import com.google.protobuf.ByteString; import dev.restate.generated.sdk.java.Java; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import java.util.stream.Stream; +import org.assertj.core.api.Assertions; -public abstract class SideEffectTestSuite implements TestSuite { +public abstract class SideEffectTestSuite implements TestDefinitions.TestSuite { protected abstract BindableService sideEffect(String sideEffectOutput); @@ -34,7 +33,7 @@ public abstract class SideEffectTestSuite implements TestSuite { protected abstract BindableService sideEffectGuard(); @Override - public Stream definitions() { + public Stream definitions() { return Stream.of( testInvocation(() -> this.sideEffect("Francesco"), GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.newBuilder().setName("Till"))) @@ -95,12 +94,12 @@ public Stream definitions() { .onlyUnbuffered() .assertingOutput( actualOutputMessages -> { - assertThat(actualOutputMessages).hasSize(2); - assertThat(actualOutputMessages) + Assertions.assertThat(actualOutputMessages).hasSize(2); + Assertions.assertThat(actualOutputMessages) .element(0) .asInstanceOf(type(Java.SideEffectEntryMessage.class)) .returns(true, Java.SideEffectEntryMessage::hasValue); - assertThat(actualOutputMessages) + Assertions.assertThat(actualOutputMessages) .element(1) .isEqualTo( Protocol.OutputStreamEntryMessage.newBuilder() @@ -114,6 +113,7 @@ public Stream definitions() { testInvocation(this::sideEffectGuard, GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.newBuilder().setName("Till"))) .assertingOutput( - containsOnlyExactErrorMessage(ProtocolException.invalidSideEffectCall()))); + AssertUtils.containsOnlyExactErrorMessage( + ProtocolException.invalidSideEffectCall()))); } } diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SleepTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/SleepTestSuite.java similarity index 83% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SleepTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/SleepTestSuite.java index 17ba0d49..c5917cc3 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/SleepTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/SleepTestSuite.java @@ -6,24 +6,25 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.Assertions.assertThat; import com.google.protobuf.Empty; import com.google.protobuf.MessageLiteOrBuilder; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import java.time.Instant; import java.util.stream.IntStream; import java.util.stream.Stream; +import org.assertj.core.api.Assertions; -public abstract class SleepTestSuite implements TestSuite { +public abstract class SleepTestSuite implements TestDefinitions.TestSuite { Long startTime = System.currentTimeMillis(); @@ -32,18 +33,20 @@ public abstract class SleepTestSuite implements TestSuite { protected abstract BindableService manySleeps(); @Override - public Stream definitions() { + public Stream definitions() { return Stream.of( testInvocation(this::sleepGreeter, GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.newBuilder().setName("Till"))) .assertingOutput( messageLites -> { - assertThat(messageLites.get(0)).isInstanceOf(Protocol.SleepEntryMessage.class); + Assertions.assertThat(messageLites.get(0)) + .isInstanceOf(Protocol.SleepEntryMessage.class); Protocol.SleepEntryMessage msg = (Protocol.SleepEntryMessage) messageLites.get(0); assertThat(msg.getWakeUpTime()).isGreaterThanOrEqualTo(startTime + 1000); assertThat(msg.getWakeUpTime()) .isLessThanOrEqualTo(Instant.now().toEpochMilli() + 1000); - assertThat(messageLites.get(1)).isInstanceOf(Protocol.SuspensionMessage.class); + Assertions.assertThat(messageLites.get(1)) + .isInstanceOf(Protocol.SuspensionMessage.class); }) .named("Sleep 1000 ms not completed"), testInvocation(this::sleepGreeter, GreeterGrpc.getGreetMethod()) diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateMachineFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java similarity index 74% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateMachineFailuresTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java index 63f6bf41..904508cf 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateMachineFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java @@ -6,23 +6,24 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.AssertUtils.*; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.AssertUtils.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.Assertions.assertThat; import dev.restate.generated.sdk.java.Java; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; import io.grpc.BindableService; import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; +import org.assertj.core.api.Assertions; -public abstract class StateMachineFailuresTestSuite implements TestSuite { +public abstract class StateMachineFailuresTestSuite implements TestDefinitions.TestSuite { protected abstract BindableService getState(AtomicInteger nonTerminalExceptionsSeen); @@ -43,7 +44,7 @@ public abstract class StateMachineFailuresTestSuite implements TestSuite { }); @Override - public Stream definitions() { + public Stream definitions() { AtomicInteger nonTerminalExceptionsSeenTest1 = new AtomicInteger(); AtomicInteger nonTerminalExceptionsSeenTest2 = new AtomicInteger(); @@ -56,9 +57,10 @@ public Stream definitions() { getStateMessage("Something")) .assertingOutput( msgs -> { - assertThat(msgs) + Assertions.assertThat(msgs) .satisfiesExactly( - protocolExceptionErrorMessage(ProtocolException.JOURNAL_MISMATCH_CODE)); + AssertUtils.protocolExceptionErrorMessage( + ProtocolException.JOURNAL_MISMATCH_CODE)); assertThat(nonTerminalExceptionsSeenTest1).hasValue(0); }) .named("Protocol Exception"), @@ -70,9 +72,10 @@ public Stream definitions() { getStateMessage("STATE", "This is not an integer")) .assertingOutput( msgs -> { - assertThat(msgs) + Assertions.assertThat(msgs) .satisfiesExactly( - errorMessageStartingWith(NumberFormatException.class.getCanonicalName())); + AssertUtils.errorMessageStartingWith( + NumberFormatException.class.getCanonicalName())); assertThat(nonTerminalExceptionsSeenTest2).hasValue(0); }) .named("Serde error"), @@ -81,8 +84,9 @@ public Stream definitions() { GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.newBuilder().setName("Till"))) .assertingOutput( - containsOnly( - errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) + AssertUtils.containsOnly( + AssertUtils.errorMessageStartingWith( + IllegalStateException.class.getCanonicalName()))) .named("Serde serialization error"), testInvocation( () -> this.sideEffectFailure(FAILING_DESERIALIZATION_INTEGER_TYPE_TAG), @@ -92,8 +96,9 @@ public Stream definitions() { inputMessage(GreetingRequest.newBuilder().setName("Till")), Java.SideEffectEntryMessage.newBuilder()) .assertingOutput( - containsOnly( - errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) + AssertUtils.containsOnly( + AssertUtils.errorMessageStartingWith( + IllegalStateException.class.getCanonicalName()))) .named("Serde deserialization error")); } } diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/StateTestSuite.java similarity index 88% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/StateTestSuite.java index 8b6d768e..75f95c8a 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/StateTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/StateTestSuite.java @@ -6,21 +6,19 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.AssertUtils.containsOnlyExactErrorMessage; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.testInvocation; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.testInvocation; import com.google.protobuf.Empty; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.BindableService; import java.util.stream.Stream; -public abstract class StateTestSuite implements TestSuite { +public abstract class StateTestSuite implements TestDefinitions.TestSuite { protected abstract BindableService getState(); @@ -109,6 +107,7 @@ public Stream definitions() { .named("With GetState completed later"), testInvocation(this::setNullState, GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.newBuilder().setName("Till"))) - .assertingOutput(containsOnlyExactErrorMessage(new NullPointerException()))); + .assertingOutput( + AssertUtils.containsOnlyExactErrorMessage(new NullPointerException()))); } } diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestDefinitions.java b/sdk-core/src/test/java/dev/restate/sdk/core/TestDefinitions.java similarity index 98% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestDefinitions.java rename to sdk-core/src/test/java/dev/restate/sdk/core/TestDefinitions.java index 3e538815..8a5f7207 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestDefinitions.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/TestDefinitions.java @@ -6,9 +6,9 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.ProtoUtils.headerFromMessage; +import static dev.restate.sdk.core.ProtoUtils.headerFromMessage; import static org.assertj.core.api.Assertions.assertThat; import com.google.protobuf.MessageLite; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestRunner.java b/sdk-core/src/test/java/dev/restate/sdk/core/TestRunner.java similarity index 94% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestRunner.java rename to sdk-core/src/test/java/dev/restate/sdk/core/TestRunner.java index 5f73d239..ea527815 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/TestRunner.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/TestRunner.java @@ -6,15 +6,15 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; import static java.lang.String.format; import static org.assertj.core.api.Assertions.entry; import static org.junit.jupiter.params.provider.Arguments.arguments; -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition; -import dev.restate.sdk.core.impl.TestDefinitions.TestExecutor; -import dev.restate.sdk.core.impl.TestDefinitions.TestSuite; +import dev.restate.sdk.core.TestDefinitions.TestDefinition; +import dev.restate.sdk.core.TestDefinitions.TestExecutor; +import dev.restate.sdk.core.TestDefinitions.TestSuite; import java.lang.reflect.Method; import java.util.List; import java.util.stream.Collectors; diff --git a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/UserFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java similarity index 87% rename from sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/UserFailuresTestSuite.java rename to sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java index f8e8d466..865b8157 100644 --- a/sdk-core-impl/src/test/java/dev/restate/sdk/core/impl/UserFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java @@ -6,17 +6,17 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.impl; +package dev.restate.sdk.core; -import static dev.restate.sdk.core.impl.AssertUtils.*; -import static dev.restate.sdk.core.impl.ProtoUtils.*; -import static dev.restate.sdk.core.impl.TestDefinitions.*; +import static dev.restate.sdk.core.AssertUtils.*; +import static dev.restate.sdk.core.ProtoUtils.*; +import static dev.restate.sdk.core.TestDefinitions.*; import static org.assertj.core.api.Assertions.assertThat; import dev.restate.generated.sdk.java.Java; -import dev.restate.sdk.core.TerminalException; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; +import dev.restate.sdk.common.TerminalException; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; import io.grpc.BindableService; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; @@ -46,14 +46,16 @@ public Stream definitions() { // Cases returning ErrorMessage testInvocation(this::throwIllegalStateException, GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.getDefaultInstance())) - .assertingOutput(containsOnlyExactErrorMessage(new IllegalStateException("Whatever"))), + .assertingOutput( + AssertUtils.containsOnlyExactErrorMessage(new IllegalStateException("Whatever"))), testInvocation( () -> this.sideEffectThrowIllegalStateException(nonTerminalExceptionsSeen), GreeterGrpc.getGreetMethod()) .withInput(startMessage(1), inputMessage(GreetingRequest.getDefaultInstance())) .assertingOutput( msgs -> { - containsOnly(exactErrorMessage(new IllegalStateException("Whatever"))); + AssertUtils.containsOnly( + AssertUtils.exactErrorMessage(new IllegalStateException("Whatever"))); // Check the counter has not been incremented assertThat(nonTerminalExceptionsSeen).hasValue(0); diff --git a/sdk-core-impl/src/test/proto/codegen.proto b/sdk-core/src/test/proto/codegen.proto similarity index 93% rename from sdk-core-impl/src/test/proto/codegen.proto rename to sdk-core/src/test/proto/codegen.proto index ecbf49d6..ee5dba2c 100644 --- a/sdk-core-impl/src/test/proto/codegen.proto +++ b/sdk-core/src/test/proto/codegen.proto @@ -9,7 +9,7 @@ syntax = "proto3"; option java_multiple_files = true; -option java_package = "dev.restate.sdk.core.impl.testservices"; +option java_package = "dev.restate.sdk.core.testservices"; option java_outer_classname = "CodegenProto"; import "dev/restate/ext.proto"; diff --git a/sdk-core-impl/src/test/proto/common.proto b/sdk-core/src/test/proto/common.proto similarity index 89% rename from sdk-core-impl/src/test/proto/common.proto rename to sdk-core/src/test/proto/common.proto index 746d3efc..a756595c 100644 --- a/sdk-core-impl/src/test/proto/common.proto +++ b/sdk-core/src/test/proto/common.proto @@ -9,7 +9,7 @@ syntax = "proto3"; option java_multiple_files = true; -option java_package = "dev.restate.sdk.core.impl.testservices"; +option java_package = "dev.restate.sdk.core.testservices"; option java_outer_classname = "CommonProto"; package common; diff --git a/sdk-core-impl/src/test/proto/counter.proto b/sdk-core/src/test/proto/counter.proto similarity index 94% rename from sdk-core-impl/src/test/proto/counter.proto rename to sdk-core/src/test/proto/counter.proto index 3e05898e..909ff8c9 100644 --- a/sdk-core-impl/src/test/proto/counter.proto +++ b/sdk-core/src/test/proto/counter.proto @@ -15,7 +15,7 @@ import "dev/restate/ext.proto"; import "common.proto"; option java_multiple_files = true; -option java_package = "dev.restate.sdk.core.impl.testservices"; +option java_package = "dev.restate.sdk.core.testservices"; option java_outer_classname = "CounterProto"; // My counter service diff --git a/sdk-core-impl/src/test/proto/greeter.proto b/sdk-core/src/test/proto/greeter.proto similarity index 92% rename from sdk-core-impl/src/test/proto/greeter.proto rename to sdk-core/src/test/proto/greeter.proto index 13759410..e9472b82 100644 --- a/sdk-core-impl/src/test/proto/greeter.proto +++ b/sdk-core/src/test/proto/greeter.proto @@ -9,7 +9,7 @@ syntax = "proto3"; option java_multiple_files = true; -option java_package = "dev.restate.sdk.core.impl.testservices"; +option java_package = "dev.restate.sdk.core.testservices"; option java_outer_classname = "GreeterProto"; import "dev/restate/ext.proto"; diff --git a/sdk-core-impl/src/test/resources/junit-platform.properties b/sdk-core/src/test/resources/junit-platform.properties similarity index 100% rename from sdk-core-impl/src/test/resources/junit-platform.properties rename to sdk-core/src/test/resources/junit-platform.properties diff --git a/sdk-core-impl/src/test/resources/log4j2.properties b/sdk-core/src/test/resources/log4j2.properties similarity index 100% rename from sdk-core-impl/src/test/resources/log4j2.properties rename to sdk-core/src/test/resources/log4j2.properties diff --git a/sdk-http-vertx/build.gradle.kts b/sdk-http-vertx/build.gradle.kts index bb105404..4f7077ba 100644 --- a/sdk-http-vertx/build.gradle.kts +++ b/sdk-http-vertx/build.gradle.kts @@ -9,8 +9,8 @@ plugins { description = "Restate SDK HTTP implementation based on Vert.x" dependencies { - api(project(":sdk-core")) - implementation(project(":sdk-core-impl")) + api(project(":sdk-api-common")) + implementation(project(":sdk-core")) implementation(platform(vertxLibs.vertx.bom)) implementation(vertxLibs.vertx.core) @@ -20,13 +20,12 @@ dependencies { implementation(coreLibs.opentelemetry.api) implementation(coreLibs.log4j.api) implementation("io.reactiverse:reactiverse-contextual-logging:1.1.2") - - testImplementation(project(":sdk-java-blocking")) - testImplementation(project(":sdk-kotlin")) - testImplementation(project(":sdk-core-impl", "testArchive")) - testImplementation(project(":sdk-java-blocking", "testArchive")) - testImplementation(project(":sdk-kotlin", "testArchive")) - testProtobuf(project(":sdk-core-impl", "testArchive")) + testImplementation(project(":sdk-api")) + testImplementation(project(":sdk-api-kotlin")) + testImplementation(project(":sdk-core", "testArchive")) + testImplementation(project(":sdk-api", "testArchive")) + testImplementation(project(":sdk-api-kotlin", "testArchive")) + testProtobuf(project(":sdk-core", "testArchive")) testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) testImplementation(vertxLibs.vertx.junit5) diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java index 31006b75..c581c79d 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java @@ -8,7 +8,7 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.http.vertx; -import dev.restate.sdk.core.impl.InvocationFlow; +import dev.restate.sdk.core.InvocationFlow; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpServerRequest; import java.util.concurrent.Flow; diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpResponseFlowAdapter.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpResponseFlowAdapter.java index 23cac687..c1c76599 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpResponseFlowAdapter.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpResponseFlowAdapter.java @@ -9,8 +9,8 @@ package dev.restate.sdk.http.vertx; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.impl.InvocationFlow; -import dev.restate.sdk.core.impl.Util; +import dev.restate.sdk.core.InvocationFlow; +import dev.restate.sdk.core.Util; import io.grpc.Status; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpServerResponse; diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageDecoder.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageDecoder.java index c65d7661..19a7b631 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageDecoder.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageDecoder.java @@ -9,8 +9,8 @@ package dev.restate.sdk.http.vertx; import com.google.protobuf.InvalidProtocolBufferException; -import dev.restate.sdk.core.impl.InvocationFlow; -import dev.restate.sdk.core.impl.MessageHeader; +import dev.restate.sdk.core.InvocationFlow; +import dev.restate.sdk.core.MessageHeader; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.vertx.core.buffer.Buffer; diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageEncoder.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageEncoder.java index 280d3ce1..b14b7eea 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageEncoder.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/MessageEncoder.java @@ -9,7 +9,7 @@ package dev.restate.sdk.http.vertx; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.impl.MessageHeader; +import dev.restate.sdk.core.MessageHeader; import io.vertx.core.buffer.Buffer; class MessageEncoder { diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RequestHttpServerHandler.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RequestHttpServerHandler.java index c6774cc5..e8bd789d 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RequestHttpServerHandler.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RequestHttpServerHandler.java @@ -13,14 +13,18 @@ import com.google.protobuf.InvalidProtocolBufferException; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.impl.*; +import dev.restate.sdk.core.InvocationHandler; +import dev.restate.sdk.core.ProtocolException; +import dev.restate.sdk.core.RestateGrpcServer; import io.grpc.Status; import io.netty.buffer.Unpooled; import io.netty.util.AsciiString; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.context.propagation.TextMapGetter; import io.reactiverse.contextual.logging.ContextualData; -import io.vertx.core.*; +import io.vertx.core.Context; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; diff --git a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RestateHttpEndpointBuilder.java b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RestateHttpEndpointBuilder.java index b1d1b528..7a3ce5cb 100644 --- a/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RestateHttpEndpointBuilder.java +++ b/sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/RestateHttpEndpointBuilder.java @@ -9,9 +9,9 @@ package dev.restate.sdk.http.vertx; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.BindableBlockingService; -import dev.restate.sdk.core.BindableNonBlockingService; -import dev.restate.sdk.core.impl.RestateGrpcServer; +import dev.restate.sdk.common.BindableBlockingService; +import dev.restate.sdk.common.BindableNonBlockingService; +import dev.restate.sdk.core.RestateGrpcServer; import io.grpc.ServerInterceptor; import io.grpc.ServerInterceptors; import io.grpc.ServerServiceDefinition; diff --git a/sdk-http-vertx/src/test/java/dev/restate/sdk/http/vertx/testservices/BlockingGreeterService.java b/sdk-http-vertx/src/test/java/dev/restate/sdk/http/vertx/testservices/BlockingGreeterService.java index 4227270c..916eeaa2 100644 --- a/sdk-http-vertx/src/test/java/dev/restate/sdk/http/vertx/testservices/BlockingGreeterService.java +++ b/sdk-http-vertx/src/test/java/dev/restate/sdk/http/vertx/testservices/BlockingGreeterService.java @@ -8,12 +8,12 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.http.vertx.testservices; -import dev.restate.sdk.blocking.RestateBlockingService; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.StateKey; -import dev.restate.sdk.core.impl.testservices.GreeterGrpc; -import dev.restate.sdk.core.impl.testservices.GreetingRequest; -import dev.restate.sdk.core.impl.testservices.GreetingResponse; +import dev.restate.sdk.RestateBlockingService; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.StateKey; +import dev.restate.sdk.core.testservices.GreeterGrpc; +import dev.restate.sdk.core.testservices.GreetingRequest; +import dev.restate.sdk.core.testservices.GreetingResponse; import io.grpc.stub.StreamObserver; import java.nio.charset.StandardCharsets; import java.time.Duration; diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTestExecutor.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTestExecutor.kt index b4c02442..8150db38 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTestExecutor.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTestExecutor.kt @@ -9,10 +9,10 @@ package dev.restate.sdk.http.vertx import com.google.protobuf.MessageLite -import dev.restate.sdk.core.BindableBlockingService -import dev.restate.sdk.core.BindableNonBlockingService -import dev.restate.sdk.core.impl.TestDefinitions.TestDefinition -import dev.restate.sdk.core.impl.TestDefinitions.TestExecutor +import dev.restate.sdk.common.BindableBlockingService +import dev.restate.sdk.common.BindableNonBlockingService +import dev.restate.sdk.core.TestDefinitions.TestDefinition +import dev.restate.sdk.core.TestDefinitions.TestExecutor import io.vertx.core.Vertx import io.vertx.core.buffer.Buffer import io.vertx.core.http.HttpHeaders diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTests.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTests.kt index c1d50a37..b6efba29 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTests.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/HttpVertxTests.kt @@ -10,14 +10,14 @@ package dev.restate.sdk.http.vertx import com.google.protobuf.ByteString import dev.restate.generated.sdk.java.Java.SideEffectEntryMessage -import dev.restate.sdk.blocking.RestateBlockingService -import dev.restate.sdk.core.impl.ProtoUtils.* -import dev.restate.sdk.core.impl.TestDefinitions.* -import dev.restate.sdk.core.impl.TestRunner -import dev.restate.sdk.core.impl.testservices.GreeterGrpc -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse +import dev.restate.sdk.* +import dev.restate.sdk.core.ProtoUtils.* +import dev.restate.sdk.core.TestDefinitions.* +import dev.restate.sdk.core.TestRunner +import dev.restate.sdk.core.testservices.GreeterGrpc +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse import dev.restate.sdk.kotlin.RestateCoroutineService import io.grpc.stub.StreamObserver import io.vertx.core.Vertx @@ -26,7 +26,7 @@ import kotlinx.coroutines.Dispatchers import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeAll -class HttpVertxTests : TestRunner() { +class HttpVertxTests : dev.restate.sdk.core.TestRunner() { lateinit var vertx: Vertx @@ -46,20 +46,24 @@ class HttpVertxTests : TestRunner() { class VertxExecutorsTest : TestSuite { private class CheckNonBlockingServiceTrampolineEventLoopContext : - GreeterGrpcKt.GreeterCoroutineImplBase(Dispatchers.Unconfined), RestateCoroutineService { - override suspend fun greet(request: GreetingRequest): GreetingResponse { + dev.restate.sdk.core.testservices.GreeterGrpcKt.GreeterCoroutineImplBase( + Dispatchers.Unconfined), + RestateCoroutineService { + override suspend fun greet( + request: dev.restate.sdk.core.testservices.GreetingRequest + ): dev.restate.sdk.core.testservices.GreetingResponse { check(Vertx.currentContext().isEventLoopContext) restateContext().sideEffect { check(Vertx.currentContext().isEventLoopContext) } check(Vertx.currentContext().isEventLoopContext) - return GreetingResponse.getDefaultInstance() + return dev.restate.sdk.core.testservices.GreetingResponse.getDefaultInstance() } } private class CheckBlockingServiceTrampolineExecutor : - GreeterGrpc.GreeterImplBase(), RestateBlockingService { + dev.restate.sdk.core.testservices.GreeterGrpc.GreeterImplBase(), RestateBlockingService { override fun greet( - request: GreetingRequest, - responseObserver: StreamObserver + request: dev.restate.sdk.core.testservices.GreetingRequest, + responseObserver: StreamObserver ) { val id = Thread.currentThread().id check(Vertx.currentContext() == null) @@ -69,7 +73,8 @@ class HttpVertxTests : TestRunner() { } check(Thread.currentThread().id == id) check(Vertx.currentContext() == null) - responseObserver.onNext(GreetingResponse.getDefaultInstance()) + responseObserver.onNext( + dev.restate.sdk.core.testservices.GreetingResponse.getDefaultInstance()) responseObserver.onCompleted() } } @@ -77,40 +82,47 @@ class HttpVertxTests : TestRunner() { override fun definitions(): Stream { return Stream.of( testInvocation( - CheckNonBlockingServiceTrampolineEventLoopContext(), GreeterGrpc.getGreetMethod()) + CheckNonBlockingServiceTrampolineEventLoopContext(), + dev.restate.sdk.core.testservices.GreeterGrpc.getGreetMethod()) .withInput( startMessage(1), - inputMessage(GreetingRequest.getDefaultInstance()), + inputMessage( + dev.restate.sdk.core.testservices.GreetingRequest.getDefaultInstance()), ackMessage(1)) .onlyUnbuffered() .expectingOutput( SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), - outputMessage(GreetingResponse.getDefaultInstance())), - testInvocation(CheckBlockingServiceTrampolineExecutor(), GreeterGrpc.getGreetMethod()) + outputMessage( + dev.restate.sdk.core.testservices.GreetingResponse.getDefaultInstance())), + testInvocation( + CheckBlockingServiceTrampolineExecutor(), + dev.restate.sdk.core.testservices.GreeterGrpc.getGreetMethod()) .withInput( startMessage(1), - inputMessage(GreetingRequest.getDefaultInstance()), + inputMessage( + dev.restate.sdk.core.testservices.GreetingRequest.getDefaultInstance()), ackMessage(1)) .onlyUnbuffered() .expectingOutput( SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), - outputMessage(GreetingResponse.getDefaultInstance()))) + outputMessage( + dev.restate.sdk.core.testservices.GreetingResponse.getDefaultInstance()))) } } override fun definitions(): Stream { return Stream.of( - dev.restate.sdk.blocking.AwakeableIdTest(), - dev.restate.sdk.blocking.DeferredTest(), - dev.restate.sdk.blocking.EagerStateTest(), - dev.restate.sdk.blocking.StateTest(), - dev.restate.sdk.blocking.InvocationIdTest(), - dev.restate.sdk.blocking.OnlyInputAndOutputTest(), - dev.restate.sdk.blocking.SideEffectTest(), - dev.restate.sdk.blocking.SleepTest(), - dev.restate.sdk.blocking.StateMachineFailuresTest(), - dev.restate.sdk.blocking.UserFailuresTest(), - dev.restate.sdk.blocking.GrpcChannelAdapterTest(), + dev.restate.sdk.AwakeableIdTest(), + dev.restate.sdk.DeferredTest(), + dev.restate.sdk.EagerStateTest(), + dev.restate.sdk.StateTest(), + dev.restate.sdk.InvocationIdTest(), + dev.restate.sdk.OnlyInputAndOutputTest(), + dev.restate.sdk.SideEffectTest(), + dev.restate.sdk.SleepTest(), + dev.restate.sdk.StateMachineFailuresTest(), + dev.restate.sdk.UserFailuresTest(), + dev.restate.sdk.GrpcChannelAdapterTest(), dev.restate.sdk.kotlin.AwakeableIdTest(), dev.restate.sdk.kotlin.DeferredTest(), dev.restate.sdk.kotlin.EagerStateTest(), 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 4d0efd70..37a5f250 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 @@ -14,8 +14,8 @@ import com.google.protobuf.MessageLite import dev.restate.generated.service.discovery.Discovery.ServiceDiscoveryRequest import dev.restate.generated.service.discovery.Discovery.ServiceDiscoveryResponse import dev.restate.generated.service.protocol.Protocol.* -import dev.restate.sdk.core.impl.ProtoUtils.* -import dev.restate.sdk.core.impl.testservices.* +import dev.restate.sdk.core.ProtoUtils.* +import dev.restate.sdk.core.testservices.* import dev.restate.sdk.http.vertx.testservices.BlockingGreeterService import dev.restate.sdk.http.vertx.testservices.GreeterKtService import io.netty.handler.codec.http.HttpResponseStatus @@ -80,7 +80,9 @@ internal class RestateHttpEndpointTest { HttpMethod.POST, endpointPort, "localhost", - "/invoke/" + GreeterGrpc.getGreetMethod().fullMethodName) + "/invoke/" + + dev.restate.sdk.core.testservices.GreeterGrpc.getGreetMethod() + .fullMethodName) .await() // Prepare request header @@ -169,7 +171,9 @@ internal class RestateHttpEndpointTest { HttpMethod.POST, endpointPort, "localhost", - "/invoke/" + GreeterGrpc.getGreetMethod().serviceName + "/unknownMethod") + "/invoke/" + + dev.restate.sdk.core.testservices.GreeterGrpc.getGreetMethod().serviceName + + "/unknownMethod") .await() // Prepare request header @@ -216,7 +220,8 @@ internal class RestateHttpEndpointTest { // Parse response val responseBody = response.body().await() val serviceDiscoveryResponse = ServiceDiscoveryResponse.parseFrom(responseBody.bytes) - assertThat(serviceDiscoveryResponse.servicesList).containsOnly(GreeterGrpc.SERVICE_NAME) + assertThat(serviceDiscoveryResponse.servicesList) + .containsOnly(dev.restate.sdk.core.testservices.GreeterGrpc.SERVICE_NAME) assertThat(serviceDiscoveryResponse.files.fileList) .map { it.name } .containsExactlyInAnyOrder( diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/testservices/GreeterKtService.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/testservices/GreeterKtService.kt index 56d480c0..e242028a 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/testservices/GreeterKtService.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/testservices/GreeterKtService.kt @@ -8,10 +8,10 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.http.vertx.testservices -import dev.restate.sdk.core.impl.testservices.GreeterGrpcKt -import dev.restate.sdk.core.impl.testservices.GreetingRequest -import dev.restate.sdk.core.impl.testservices.GreetingResponse -import dev.restate.sdk.core.impl.testservices.greetingResponse +import dev.restate.sdk.core.testservices.GreeterGrpcKt +import dev.restate.sdk.core.testservices.GreetingRequest +import dev.restate.sdk.core.testservices.GreetingResponse +import dev.restate.sdk.core.testservices.greetingResponse import dev.restate.sdk.kotlin.RestateCoroutineService import kotlin.coroutines.CoroutineContext import kotlin.time.Duration.Companion.seconds diff --git a/sdk-lambda/build.gradle.kts b/sdk-lambda/build.gradle.kts index 15ce37a4..cc816855 100644 --- a/sdk-lambda/build.gradle.kts +++ b/sdk-lambda/build.gradle.kts @@ -9,8 +9,8 @@ plugins { description = "Restate SDK AWS Lambda integration" dependencies { - api(project(":sdk-core")) - implementation(project(":sdk-core-impl")) + api(project(":sdk-api-common")) + implementation(project(":sdk-core")) api(lambdaLibs.core) api(lambdaLibs.events) @@ -19,10 +19,9 @@ dependencies { implementation(coreLibs.opentelemetry.api) implementation(coreLibs.log4j.api) - - testImplementation(project(":sdk-java-blocking")) - testImplementation(project(":sdk-kotlin")) - testImplementation(project(":sdk-core-impl", "testArchive")) + testImplementation(project(":sdk-api")) + testImplementation(project(":sdk-api-kotlin")) + testImplementation(project(":sdk-core", "testArchive")) testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) diff --git a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/LambdaFlowAdapters.java b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/LambdaFlowAdapters.java index c2a6a45e..d12e1e70 100644 --- a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/LambdaFlowAdapters.java +++ b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/LambdaFlowAdapters.java @@ -10,8 +10,8 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.MessageLite; -import dev.restate.sdk.core.impl.InvocationFlow; -import dev.restate.sdk.core.impl.MessageHeader; +import dev.restate.sdk.core.InvocationFlow; +import dev.restate.sdk.core.MessageHeader; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; diff --git a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpoint.java b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpoint.java index 60b83761..4c0af33a 100644 --- a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpoint.java +++ b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpoint.java @@ -15,9 +15,9 @@ import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import com.google.protobuf.InvalidProtocolBufferException; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.impl.InvocationHandler; -import dev.restate.sdk.core.impl.ProtocolException; -import dev.restate.sdk.core.impl.RestateGrpcServer; +import dev.restate.sdk.core.InvocationHandler; +import dev.restate.sdk.core.ProtocolException; +import dev.restate.sdk.core.RestateGrpcServer; import io.grpc.Status; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.context.propagation.TextMapGetter; diff --git a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpointBuilder.java b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpointBuilder.java index 0ff0e4aa..d4a31de4 100644 --- a/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpointBuilder.java +++ b/sdk-lambda/src/main/java/dev/restate/sdk/lambda/RestateLambdaEndpointBuilder.java @@ -9,9 +9,9 @@ package dev.restate.sdk.lambda; import dev.restate.generated.service.discovery.Discovery; -import dev.restate.sdk.core.BindableBlockingService; -import dev.restate.sdk.core.BindableNonBlockingService; -import dev.restate.sdk.core.impl.RestateGrpcServer; +import dev.restate.sdk.common.BindableBlockingService; +import dev.restate.sdk.common.BindableNonBlockingService; +import dev.restate.sdk.core.RestateGrpcServer; import io.grpc.ServerInterceptor; import io.grpc.ServerInterceptors; import io.grpc.ServerServiceDefinition; 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 45150b75..9b702b0b 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 @@ -22,8 +22,8 @@ import com.google.protobuf.MessageLite; import dev.restate.generated.service.discovery.Discovery; import dev.restate.generated.service.protocol.Protocol; -import dev.restate.sdk.core.impl.MessageHeader; -import dev.restate.sdk.core.impl.ProtoUtils; +import dev.restate.sdk.core.MessageHeader; +import dev.restate.sdk.core.ProtoUtils; import dev.restate.sdk.lambda.testservices.CounterRequest; import dev.restate.sdk.lambda.testservices.JavaCounterGrpc; import dev.restate.sdk.lambda.testservices.KotlinCounterGrpc; diff --git a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/testservices/JavaCounterService.java b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/testservices/JavaCounterService.java index 3d91c1b2..cc4da40e 100644 --- a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/testservices/JavaCounterService.java +++ b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/testservices/JavaCounterService.java @@ -8,9 +8,9 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.lambda.testservices; -import dev.restate.sdk.blocking.RestateBlockingService; -import dev.restate.sdk.core.Serde; -import dev.restate.sdk.core.StateKey; +import dev.restate.sdk.RestateBlockingService; +import dev.restate.sdk.common.Serde; +import dev.restate.sdk.common.StateKey; import io.grpc.stub.StreamObserver; import java.nio.charset.StandardCharsets; diff --git a/sdk-serde-jackson/build.gradle.kts b/sdk-serde-jackson/build.gradle.kts index cb7603fd..2ecdbbae 100644 --- a/sdk-serde-jackson/build.gradle.kts +++ b/sdk-serde-jackson/build.gradle.kts @@ -13,5 +13,5 @@ dependencies { testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) - implementation(project(":sdk-core")) + implementation(project(":sdk-api-common")) } diff --git a/sdk-serde-jackson/src/main/java/dev/restate/sdk/core/serde/jackson/JacksonSerdes.java b/sdk-serde-jackson/src/main/java/dev/restate/sdk/serde/jackson/JacksonSerdes.java similarity index 96% rename from sdk-serde-jackson/src/main/java/dev/restate/sdk/core/serde/jackson/JacksonSerdes.java rename to sdk-serde-jackson/src/main/java/dev/restate/sdk/serde/jackson/JacksonSerdes.java index cb06b65d..665209fb 100644 --- a/sdk-serde-jackson/src/main/java/dev/restate/sdk/core/serde/jackson/JacksonSerdes.java +++ b/sdk-serde-jackson/src/main/java/dev/restate/sdk/serde/jackson/JacksonSerdes.java @@ -6,12 +6,12 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core.serde.jackson; +package dev.restate.sdk.serde.jackson; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import dev.restate.sdk.core.Serde; +import dev.restate.sdk.common.Serde; import java.io.IOException; import javax.annotation.Nullable; diff --git a/sdk-serde-jackson/src/test/java/dev/restate/sdk/core/JacksonSerdesTest.java b/sdk-serde-jackson/src/test/java/dev/restate/sdk/serde/jackson/JacksonSerdesTest.java similarity index 96% rename from sdk-serde-jackson/src/test/java/dev/restate/sdk/core/JacksonSerdesTest.java rename to sdk-serde-jackson/src/test/java/dev/restate/sdk/serde/jackson/JacksonSerdesTest.java index edf27990..cc702f21 100644 --- a/sdk-serde-jackson/src/test/java/dev/restate/sdk/core/JacksonSerdesTest.java +++ b/sdk-serde-jackson/src/test/java/dev/restate/sdk/serde/jackson/JacksonSerdesTest.java @@ -6,14 +6,14 @@ // You can find a copy of the license in file LICENSE in the root // directory of this repository or package, or at // https://github.com/restatedev/sdk-java/blob/main/LICENSE -package dev.restate.sdk.core; +package dev.restate.sdk.serde.jackson; import static org.assertj.core.api.Assertions.assertThat; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; -import dev.restate.sdk.core.serde.jackson.JacksonSerdes; +import dev.restate.sdk.common.Serde; import java.util.List; import java.util.Objects; import java.util.Set; diff --git a/sdk-test/build.gradle.kts b/sdk-testing/build.gradle.kts similarity index 92% rename from sdk-test/build.gradle.kts rename to sdk-testing/build.gradle.kts index 1fcea62b..154c0c57 100644 --- a/sdk-test/build.gradle.kts +++ b/sdk-testing/build.gradle.kts @@ -8,7 +8,7 @@ plugins { description = "Restate SDK testing tools" dependencies { - api(project(":sdk-core")) + api(project(":sdk-api-common")) api(testingLibs.junit.api) api(testingLibs.testcontainers.core) @@ -20,7 +20,7 @@ dependencies { implementation(coreLibs.grpc.netty.shaded) testCompileOnly(coreLibs.javax.annotation.api) - testImplementation(project(":sdk-java-blocking")) + testImplementation(project(":sdk-api")) testImplementation(testingLibs.assertj) testImplementation(testingLibs.junit.jupiter) testImplementation(coreLibs.grpc.stub) diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/BaseRestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/BaseRestateRunner.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/BaseRestateRunner.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/BaseRestateRunner.java diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateAdminClient.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateAdminClient.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/RestateAdminClient.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/RestateAdminClient.java diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateGrpcChannel.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateGrpcChannel.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/RestateGrpcChannel.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/RestateGrpcChannel.java diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/RestateRunner.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunner.java diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java similarity index 96% rename from sdk-test/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java index 21fa9aa8..2da44dd0 100644 --- a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateRunnerBuilder.java @@ -8,8 +8,8 @@ // https://github.com/restatedev/sdk-java/blob/main/LICENSE package dev.restate.sdk.testing; -import dev.restate.sdk.core.BindableBlockingService; -import dev.restate.sdk.core.BindableNonBlockingService; +import dev.restate.sdk.common.BindableBlockingService; +import dev.restate.sdk.common.BindableNonBlockingService; import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder; import io.grpc.ServerInterceptor; import java.util.HashMap; diff --git a/sdk-test/src/main/java/dev/restate/sdk/testing/RestateURL.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/RestateURL.java similarity index 100% rename from sdk-test/src/main/java/dev/restate/sdk/testing/RestateURL.java rename to sdk-testing/src/main/java/dev/restate/sdk/testing/RestateURL.java diff --git a/sdk-test/src/test/java/dev/restate/sdk/testing/Counter.java b/sdk-testing/src/test/java/dev/restate/sdk/testing/Counter.java similarity index 92% rename from sdk-test/src/test/java/dev/restate/sdk/testing/Counter.java rename to sdk-testing/src/test/java/dev/restate/sdk/testing/Counter.java index 72f1224c..b2bc7f39 100644 --- a/sdk-test/src/test/java/dev/restate/sdk/testing/Counter.java +++ b/sdk-testing/src/test/java/dev/restate/sdk/testing/Counter.java @@ -9,10 +9,10 @@ package dev.restate.sdk.testing; import com.google.protobuf.Empty; -import dev.restate.sdk.blocking.RestateBlockingService; -import dev.restate.sdk.blocking.RestateContext; -import dev.restate.sdk.core.CoreSerdes; -import dev.restate.sdk.core.StateKey; +import dev.restate.sdk.RestateBlockingService; +import dev.restate.sdk.RestateContext; +import dev.restate.sdk.common.CoreSerdes; +import dev.restate.sdk.common.StateKey; import dev.restate.sdk.examples.generated.*; import io.grpc.stub.StreamObserver; import org.apache.logging.log4j.LogManager; diff --git a/sdk-test/src/test/java/dev/restate/sdk/testing/CounterTest.java b/sdk-testing/src/test/java/dev/restate/sdk/testing/CounterTest.java similarity index 100% rename from sdk-test/src/test/java/dev/restate/sdk/testing/CounterTest.java rename to sdk-testing/src/test/java/dev/restate/sdk/testing/CounterTest.java diff --git a/sdk-test/src/test/proto/counter.proto b/sdk-testing/src/test/proto/counter.proto similarity index 100% rename from sdk-test/src/test/proto/counter.proto rename to sdk-testing/src/test/proto/counter.proto diff --git a/sdk-test/src/test/resources/log4j2.properties b/sdk-testing/src/test/resources/log4j2.properties similarity index 100% rename from sdk-test/src/test/resources/log4j2.properties rename to sdk-testing/src/test/resources/log4j2.properties diff --git a/settings.gradle.kts b/settings.gradle.kts index d0339844..3b0cac92 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,15 +10,15 @@ rootProject.name = "sdk-java" include( + "sdk-api-common", + "sdk-api", + "sdk-api-kotlin", "sdk-core", - "sdk-core-impl", "sdk-serde-jackson", "sdk-http-vertx", - "sdk-java-blocking", - "protoc-gen-restate-java-blocking", + "protoc-gen-restate", "sdk-lambda", - "sdk-kotlin", - "sdk-test", + "sdk-testing", "examples", "admin-client") From aba26497ddf750ec58c7ed5b3ce408933010c78f Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 27 Nov 2023 11:36:37 +0100 Subject: [PATCH 2/2] sdk-api-common -> sdk-common Fix readme --- README.md | 12 ++++++------ protoc-gen-restate/build.gradle.kts | 2 +- sdk-api-kotlin/build.gradle.kts | 2 +- sdk-api/build.gradle.kts | 2 +- {sdk-api-common => sdk-common}/build.gradle.kts | 0 .../sdk/common/AbortedExecutionException.java | 0 .../restate/sdk/common/BindableBlockingService.java | 0 .../sdk/common/BindableNonBlockingService.java | 0 .../main/java/dev/restate/sdk/common/CoreSerdes.java | 0 .../java/dev/restate/sdk/common/InvocationId.java | 0 .../src/main/java/dev/restate/sdk/common/Serde.java | 0 .../main/java/dev/restate/sdk/common/StateKey.java | 0 .../dev/restate/sdk/common/TerminalException.java | 0 .../sdk/common/function/ThrowingFunction.java | 0 .../sdk/common/function/ThrowingRunnable.java | 0 .../sdk/common/function/ThrowingSupplier.java | 0 .../restate/sdk/common/syscalls/DeferredResult.java | 0 .../syscalls/EnterSideEffectSyscallCallback.java | 0 .../syscalls/ExitSideEffectSyscallCallback.java | 0 .../dev/restate/sdk/common/syscalls/ReadyResult.java | 0 .../sdk/common/syscalls/ReadyResultHolder.java | 0 .../restate/sdk/common/syscalls/SyscallCallback.java | 0 .../dev/restate/sdk/common/syscalls/Syscalls.java | 0 .../src/main/proto/.github/workflows/lint.yaml | 0 .../src/main/proto/.gitignore | 0 .../src/main/proto/.protolint.yaml | 0 .../src/main/proto/LICENSE | 0 .../src/main/proto/README.md | 0 .../src/main/proto/buf.yaml | 0 .../src/main/proto/dev/restate/events.proto | 0 .../src/main/proto/dev/restate/ext.proto | 0 .../src/main/proto/dev/restate/services.proto | 0 .../java/dev/restate/sdk/common/CoreSerdesTest.java | 0 sdk-core/build.gradle.kts | 2 +- sdk-http-vertx/build.gradle.kts | 2 +- sdk-lambda/build.gradle.kts | 2 +- sdk-serde-jackson/build.gradle.kts | 2 +- sdk-testing/build.gradle.kts | 2 +- settings.gradle.kts | 2 +- 39 files changed, 15 insertions(+), 15 deletions(-) rename {sdk-api-common => sdk-common}/build.gradle.kts (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/BindableBlockingService.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/CoreSerdes.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/InvocationId.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/Serde.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/StateKey.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/TerminalException.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java (100%) rename {sdk-api-common => sdk-common}/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java (100%) rename {sdk-api-common => sdk-common}/src/main/proto/.github/workflows/lint.yaml (100%) rename {sdk-api-common => sdk-common}/src/main/proto/.gitignore (100%) rename {sdk-api-common => sdk-common}/src/main/proto/.protolint.yaml (100%) rename {sdk-api-common => sdk-common}/src/main/proto/LICENSE (100%) rename {sdk-api-common => sdk-common}/src/main/proto/README.md (100%) rename {sdk-api-common => sdk-common}/src/main/proto/buf.yaml (100%) rename {sdk-api-common => sdk-common}/src/main/proto/dev/restate/events.proto (100%) rename {sdk-api-common => sdk-common}/src/main/proto/dev/restate/ext.proto (100%) rename {sdk-api-common => sdk-common}/src/main/proto/dev/restate/services.proto (100%) rename {sdk-api-common => sdk-common}/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java (100%) diff --git a/README.md b/README.md index b5f08bfa..06e91c97 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ gradle init --type java-application Add the dependency [sdk-api](sdk-api): ``` -implementation("dev.restate.sdk:sdk-api:1.0-SNAPSHOT") +implementation("dev.restate:sdk-api:1.0-SNAPSHOT") ``` Now you need to configure the protobuf plugin to build your Protobuf contracts. For example, with Gradle (Kotlin script): @@ -61,7 +61,7 @@ protobuf { plugins { // The Restate plugin depends on the gRPC generated code id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:1.58.0" } - id("restate") { artifact = "dev.restate.sdk:protoc-gen-restate:1.0-SNAPSHOT:all@jar" } + id("restate") { artifact = "dev.restate:protoc-gen-restate:1.0-SNAPSHOT:all@jar" } } generateProtoTasks { @@ -88,7 +88,7 @@ gradle init --type kotlin-application Add the dependency [`sdk-api-kotlin`](sdk-api-kotlin): ``` -implementation("dev.restate.sdk:sdk-api-kotlin:1.0-SNAPSHOT") +implementation("dev.restate:sdk-api-kotlin:1.0-SNAPSHOT") ``` Now you need to configure the protobuf plugin to build your Protobuf contracts. For example, with Gradle (Kotlin script): @@ -221,7 +221,7 @@ If you want to use POJOs for state, check [how to use Jackson](#state-serde-usin To deploy the Restate service as HTTP server, add [`sdk-http-vertx`](sdk-http-vertx) to the dependencies. For example, in Gradle: ``` -implementation("dev.restate.sdk:sdk-http-vertx:1.0-SNAPSHOT") +implementation("dev.restate:sdk-http-vertx:1.0-SNAPSHOT") ``` To deploy the service, add the following code to the `main`. For example in Java: @@ -255,7 +255,7 @@ gradle run To deploy the Restate service as Lambda, add [`sdk-lambda`](sdk-lambda) to the dependencies. For example, in Gradle: ``` -implementation("dev.restate.sdk:sdk-lambda:1.0-SNAPSHOT") +implementation("dev.restate:sdk-lambda:1.0-SNAPSHOT") ``` Configure the build tool to generate Fat-JARs, which are required by AWS Lambda to correctly load the JAR. For example, using Gradle: @@ -307,7 +307,7 @@ State ser/de is defined by the interface `Serde`. If you want to use [Jackson Da For example, in Gradle: ``` -implementation("dev.restate.sdk:sdk-serde-jackson:1.0-SNAPSHOT") +implementation("dev.restate:sdk-serde-jackson:1.0-SNAPSHOT") ``` And then use `JacksonSerdes`: diff --git a/protoc-gen-restate/build.gradle.kts b/protoc-gen-restate/build.gradle.kts index f9bda1d4..ba1c42a8 100644 --- a/protoc-gen-restate/build.gradle.kts +++ b/protoc-gen-restate/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { implementation("com.salesforce.servicelibs:jprotoc:1.2.2") { exclude("javax.annotation", "javax.annotation-api") } - implementation(project(":sdk-api-common")) + implementation(project(":sdk-common")) } application { mainClass.set("dev.restate.sdk.gen.JavaGen") } diff --git a/sdk-api-kotlin/build.gradle.kts b/sdk-api-kotlin/build.gradle.kts index 9830520c..46fa1d82 100644 --- a/sdk-api-kotlin/build.gradle.kts +++ b/sdk-api-kotlin/build.gradle.kts @@ -9,7 +9,7 @@ plugins { description = "Restate SDK Kotlin APIs" dependencies { - api(project(":sdk-api-common")) + api(project(":sdk-common")) implementation(kotlinLibs.kotlinx.coroutines) diff --git a/sdk-api/build.gradle.kts b/sdk-api/build.gradle.kts index 2b1f3bb9..34588c22 100644 --- a/sdk-api/build.gradle.kts +++ b/sdk-api/build.gradle.kts @@ -8,7 +8,7 @@ plugins { description = "Restate SDK APIs" dependencies { - api(project(":sdk-api-common")) + api(project(":sdk-common")) testCompileOnly(coreLibs.javax.annotation.api) diff --git a/sdk-api-common/build.gradle.kts b/sdk-common/build.gradle.kts similarity index 100% rename from sdk-api-common/build.gradle.kts rename to sdk-common/build.gradle.kts diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java b/sdk-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java rename to sdk-common/src/main/java/dev/restate/sdk/common/AbortedExecutionException.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java b/sdk-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java rename to sdk-common/src/main/java/dev/restate/sdk/common/BindableBlockingService.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java b/sdk-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java rename to sdk-common/src/main/java/dev/restate/sdk/common/BindableNonBlockingService.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java b/sdk-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java rename to sdk-common/src/main/java/dev/restate/sdk/common/CoreSerdes.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/InvocationId.java b/sdk-common/src/main/java/dev/restate/sdk/common/InvocationId.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/InvocationId.java rename to sdk-common/src/main/java/dev/restate/sdk/common/InvocationId.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/Serde.java b/sdk-common/src/main/java/dev/restate/sdk/common/Serde.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/Serde.java rename to sdk-common/src/main/java/dev/restate/sdk/common/Serde.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/StateKey.java b/sdk-common/src/main/java/dev/restate/sdk/common/StateKey.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/StateKey.java rename to sdk-common/src/main/java/dev/restate/sdk/common/StateKey.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/TerminalException.java b/sdk-common/src/main/java/dev/restate/sdk/common/TerminalException.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/TerminalException.java rename to sdk-common/src/main/java/dev/restate/sdk/common/TerminalException.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java b/sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java rename to sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingFunction.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java b/sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java rename to sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingRunnable.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java b/sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java rename to sdk-common/src/main/java/dev/restate/sdk/common/function/ThrowingSupplier.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/DeferredResult.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/EnterSideEffectSyscallCallback.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ExitSideEffectSyscallCallback.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResult.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/ReadyResultHolder.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/SyscallCallback.java diff --git a/sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java b/sdk-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java similarity index 100% rename from sdk-api-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java rename to sdk-common/src/main/java/dev/restate/sdk/common/syscalls/Syscalls.java diff --git a/sdk-api-common/src/main/proto/.github/workflows/lint.yaml b/sdk-common/src/main/proto/.github/workflows/lint.yaml similarity index 100% rename from sdk-api-common/src/main/proto/.github/workflows/lint.yaml rename to sdk-common/src/main/proto/.github/workflows/lint.yaml diff --git a/sdk-api-common/src/main/proto/.gitignore b/sdk-common/src/main/proto/.gitignore similarity index 100% rename from sdk-api-common/src/main/proto/.gitignore rename to sdk-common/src/main/proto/.gitignore diff --git a/sdk-api-common/src/main/proto/.protolint.yaml b/sdk-common/src/main/proto/.protolint.yaml similarity index 100% rename from sdk-api-common/src/main/proto/.protolint.yaml rename to sdk-common/src/main/proto/.protolint.yaml diff --git a/sdk-api-common/src/main/proto/LICENSE b/sdk-common/src/main/proto/LICENSE similarity index 100% rename from sdk-api-common/src/main/proto/LICENSE rename to sdk-common/src/main/proto/LICENSE diff --git a/sdk-api-common/src/main/proto/README.md b/sdk-common/src/main/proto/README.md similarity index 100% rename from sdk-api-common/src/main/proto/README.md rename to sdk-common/src/main/proto/README.md diff --git a/sdk-api-common/src/main/proto/buf.yaml b/sdk-common/src/main/proto/buf.yaml similarity index 100% rename from sdk-api-common/src/main/proto/buf.yaml rename to sdk-common/src/main/proto/buf.yaml diff --git a/sdk-api-common/src/main/proto/dev/restate/events.proto b/sdk-common/src/main/proto/dev/restate/events.proto similarity index 100% rename from sdk-api-common/src/main/proto/dev/restate/events.proto rename to sdk-common/src/main/proto/dev/restate/events.proto diff --git a/sdk-api-common/src/main/proto/dev/restate/ext.proto b/sdk-common/src/main/proto/dev/restate/ext.proto similarity index 100% rename from sdk-api-common/src/main/proto/dev/restate/ext.proto rename to sdk-common/src/main/proto/dev/restate/ext.proto diff --git a/sdk-api-common/src/main/proto/dev/restate/services.proto b/sdk-common/src/main/proto/dev/restate/services.proto similarity index 100% rename from sdk-api-common/src/main/proto/dev/restate/services.proto rename to sdk-common/src/main/proto/dev/restate/services.proto diff --git a/sdk-api-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java b/sdk-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java similarity index 100% rename from sdk-api-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java rename to sdk-common/src/test/java/dev/restate/sdk/common/CoreSerdesTest.java diff --git a/sdk-core/build.gradle.kts b/sdk-core/build.gradle.kts index 2e300d80..7b87e852 100644 --- a/sdk-core/build.gradle.kts +++ b/sdk-core/build.gradle.kts @@ -10,7 +10,7 @@ description = "Restate SDK Core" sourceSets { main { proto { srcDirs("src/main/sdk-proto", "src/main/service-protocol") } } } dependencies { - implementation(project(":sdk-api-common")) + implementation(project(":sdk-common")) implementation(coreLibs.protobuf.java) implementation(coreLibs.grpc.api) diff --git a/sdk-http-vertx/build.gradle.kts b/sdk-http-vertx/build.gradle.kts index 4f7077ba..7ff57d35 100644 --- a/sdk-http-vertx/build.gradle.kts +++ b/sdk-http-vertx/build.gradle.kts @@ -9,7 +9,7 @@ plugins { description = "Restate SDK HTTP implementation based on Vert.x" dependencies { - api(project(":sdk-api-common")) + api(project(":sdk-common")) implementation(project(":sdk-core")) implementation(platform(vertxLibs.vertx.bom)) diff --git a/sdk-lambda/build.gradle.kts b/sdk-lambda/build.gradle.kts index cc816855..9c5db4a7 100644 --- a/sdk-lambda/build.gradle.kts +++ b/sdk-lambda/build.gradle.kts @@ -9,7 +9,7 @@ plugins { description = "Restate SDK AWS Lambda integration" dependencies { - api(project(":sdk-api-common")) + api(project(":sdk-common")) implementation(project(":sdk-core")) api(lambdaLibs.core) diff --git a/sdk-serde-jackson/build.gradle.kts b/sdk-serde-jackson/build.gradle.kts index 2ecdbbae..134654c8 100644 --- a/sdk-serde-jackson/build.gradle.kts +++ b/sdk-serde-jackson/build.gradle.kts @@ -13,5 +13,5 @@ dependencies { testImplementation(testingLibs.junit.jupiter) testImplementation(testingLibs.assertj) - implementation(project(":sdk-api-common")) + implementation(project(":sdk-common")) } diff --git a/sdk-testing/build.gradle.kts b/sdk-testing/build.gradle.kts index 154c0c57..0f48f994 100644 --- a/sdk-testing/build.gradle.kts +++ b/sdk-testing/build.gradle.kts @@ -8,7 +8,7 @@ plugins { description = "Restate SDK testing tools" dependencies { - api(project(":sdk-api-common")) + api(project(":sdk-common")) api(testingLibs.junit.api) api(testingLibs.testcontainers.core) diff --git a/settings.gradle.kts b/settings.gradle.kts index 3b0cac92..80c502d6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,7 +10,7 @@ rootProject.name = "sdk-java" include( - "sdk-api-common", + "sdk-common", "sdk-api", "sdk-api-kotlin", "sdk-core",