diff --git a/README-zh.md b/README-zh.md
index 7665946..ab46592 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -1,3 +1,10 @@
+
+ sdk-runtime/sdk-reactor
+ ↑ ↑
+ sdk-domain -> sdk-grpc
+ ↑ ↑
+ sdk-infrastructure spec-pb
+
## 如何使用java sdk
### 1. import sdk
对于 Maven 项目,将以下配置添加进 `pom.xml` 文件:
diff --git a/examples/pom.xml b/examples/pom.xml
index 015e86b..fa724e0 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -57,4 +57,5 @@
+
\ No newline at end of file
diff --git a/examples/src/test/java/io/mosn/layotto/examples/file/File.java b/examples/src/test/java/io/mosn/layotto/examples/file/File.java
index 43f2fc1..8ebe6bc 100644
--- a/examples/src/test/java/io/mosn/layotto/examples/file/File.java
+++ b/examples/src/test/java/io/mosn/layotto/examples/file/File.java
@@ -15,7 +15,7 @@
package io.mosn.layotto.examples.file;
import io.mosn.layotto.v1.RuntimeClientBuilder;
-import io.mosn.layotto.v1.config.RuntimeProperties;
+import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import spec.sdk.runtime.v1.client.RuntimeClient;
diff --git a/examples/src/test/java/io/mosn/layotto/examples/helloworld/Hello.java b/examples/src/test/java/io/mosn/layotto/examples/helloworld/Hello.java
index da35ec3..937e293 100644
--- a/examples/src/test/java/io/mosn/layotto/examples/helloworld/Hello.java
+++ b/examples/src/test/java/io/mosn/layotto/examples/helloworld/Hello.java
@@ -15,7 +15,7 @@
package io.mosn.layotto.examples.helloworld;
import io.mosn.layotto.v1.RuntimeClientBuilder;
-import io.mosn.layotto.v1.config.RuntimeProperties;
+import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;
public class Hello {
diff --git a/examples/src/test/java/io/mosn/layotto/examples/pubsub/publisher/Publisher.java b/examples/src/test/java/io/mosn/layotto/examples/pubsub/publisher/Publisher.java
index e7b14d9..5a1e549 100644
--- a/examples/src/test/java/io/mosn/layotto/examples/pubsub/publisher/Publisher.java
+++ b/examples/src/test/java/io/mosn/layotto/examples/pubsub/publisher/Publisher.java
@@ -15,7 +15,7 @@
package io.mosn.layotto.examples.pubsub.publisher;
import io.mosn.layotto.v1.RuntimeClientBuilder;
-import io.mosn.layotto.v1.config.RuntimeProperties;
+import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;
public class Publisher {
diff --git a/examples/src/test/java/io/mosn/layotto/examples/pubsub/subscriber/impl/RawSubscriber.java b/examples/src/test/java/io/mosn/layotto/examples/pubsub/subscriber/impl/RawSubscriber.java
index 3121c4e..183a5c3 100644
--- a/examples/src/test/java/io/mosn/layotto/examples/pubsub/subscriber/impl/RawSubscriber.java
+++ b/examples/src/test/java/io/mosn/layotto/examples/pubsub/subscriber/impl/RawSubscriber.java
@@ -14,7 +14,7 @@
*/
package io.mosn.layotto.examples.pubsub.subscriber.impl;
-import io.mosn.layotto.v1.callback.component.pubsub.Subscriber;
+import io.mosn.layotto.v1.grpc.callback.component.pubsub.Subscriber;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import spec.sdk.runtime.v1.domain.pubsub.TopicEventRequest;
diff --git a/examples/src/test/java/io/mosn/layotto/examples/state/RedisCRUD.java b/examples/src/test/java/io/mosn/layotto/examples/state/RedisCRUD.java
index 34e4b13..9a8d9b5 100644
--- a/examples/src/test/java/io/mosn/layotto/examples/state/RedisCRUD.java
+++ b/examples/src/test/java/io/mosn/layotto/examples/state/RedisCRUD.java
@@ -15,7 +15,7 @@
package io.mosn.layotto.examples.state;
import io.mosn.layotto.v1.RuntimeClientBuilder;
-import io.mosn.layotto.v1.config.RuntimeProperties;
+import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;
import spec.sdk.runtime.v1.domain.state.GetBulkStateRequest;
import spec.sdk.runtime.v1.domain.state.State;
@@ -25,6 +25,7 @@
import java.util.List;
public class RedisCRUD {
+
static String storeName = "redis";
static String key1 = "key1";
static String key2 = "key2";
diff --git a/pom.xml b/pom.xml
index d57ab0a..eb08874 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,10 +13,14 @@
https://github.com/mosn/layotto
- sdk
examples
+ sdk
sdk-reactor
spec
+ sdk-grpc
+ sdk-domain-rx
+ sdk-domain
+ sdk-infrastructure
@@ -36,11 +40,37 @@
runtime-sdk
${project.version}
+
+ io.mosn.layotto
+ runtime-sdk-reactor
+ ${project.version}
+
io.mosn.layotto
runtime-spec-pb
${project.version}
+
+ io.mosn.layotto
+ runtime-sdk-grpc
+ ${project.version}
+
+
+ io.mosn.layotto
+ runtime-sdk-domain-rx
+ ${project.version}
+
+
+ io.mosn.layotto
+ runtime-sdk-domain
+ ${project.version}
+
+
+ io.mosn.layotto
+ runtime-sdk-infrastructure
+ ${project.version}
+
+
com.alibaba
@@ -76,6 +106,7 @@
grpc-stub
${grpc.version}
+
org.mockito
@@ -203,6 +234,7 @@
http://github.com/mosn/layotto
scm:git:https://github.com/mosn/layotto.git
+
release
@@ -260,4 +292,5 @@
+
diff --git a/sdk-domain-rx/pom.xml b/sdk-domain-rx/pom.xml
new file mode 100644
index 0000000..992b4a3
--- /dev/null
+++ b/sdk-domain-rx/pom.xml
@@ -0,0 +1,35 @@
+
+
+ 4.0.0
+
+
+ runtime-sdk-parent
+ io.mosn.layotto
+ 1.1.0-SNAPSHOT
+
+
+ runtime-sdk-domain-rx
+ runtime-sdk-domain-rx
+ Reactor domain definition for Runtime
+ jar
+
+
+ 3.4.12
+
+
+
+
+ io.mosn.layotto
+ runtime-sdk-domain
+
+
+
+ io.projectreactor
+ reactor-core
+ ${reactor-core.version}
+
+
+
+
\ No newline at end of file
diff --git a/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/ConfigurationRxRuntime.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/ConfigurationRxRuntime.java
new file mode 100644
index 0000000..68548d2
--- /dev/null
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/ConfigurationRxRuntime.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.rx;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.ConfigurationRuntime;
+import spec.sdk.runtime.v1.domain.configuration.ConfigurationItem;
+import spec.sdk.runtime.v1.domain.configuration.ConfigurationRequestItem;
+import spec.sdk.runtime.v1.domain.configuration.SaveConfigurationRequest;
+import spec.sdk.runtime.v1.domain.configuration.SubConfigurationResp;
+
+import java.util.List;
+
+public interface ConfigurationRxRuntime extends ConfigurationRuntime {
+
+ /**
+ * Gets configuration from configuration store
+ *
+ * @param configurationRequestItem Request object.
+ */
+ @Override
+ default List getConfiguration(ConfigurationRequestItem configurationRequestItem) {
+ return getConfigurationAsync(configurationRequestItem).block();
+ }
+
+ Mono> getConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
+
+ /**
+ * Saves configuration into configuration store.
+ * ø
+ *
+ * @param saveConfigurationRequest Request object.
+ */
+ @Override
+ default void saveConfiguration(SaveConfigurationRequest saveConfigurationRequest) {
+ saveConfigurationAsync(saveConfigurationRequest).block();
+ }
+
+ Mono saveConfigurationAsync(SaveConfigurationRequest saveConfigurationRequest);
+
+ /**
+ * Deletes configuration from configuration store.
+ *
+ * @param configurationRequestItem Request object.
+ */
+ @Override
+ default void deleteConfiguration(ConfigurationRequestItem configurationRequestItem) {
+ deleteConfigurationAsync(configurationRequestItem).block();
+ }
+
+ Mono deleteConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
+
+ /**
+ * Gets configuration from configuration store and subscribe the updates.
+ *
+ * @param configurationRequestItem Request object.
+ */
+ @Override
+ default void subscribeConfiguration(ConfigurationRequestItem configurationRequestItem, Subscriber subscriber) {
+ Flux subscribeConfigurationAsync = subscribeConfigurationAsync(configurationRequestItem);
+ subscribeConfigurationAsync.subscribe(
+ subscriber::onNext,
+ subscriber::onError,
+ subscriber::onComplete);
+ }
+
+ Flux subscribeConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
+}
diff --git a/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/FileRxRuntime.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/FileRxRuntime.java
new file mode 100644
index 0000000..db6703f
--- /dev/null
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/FileRxRuntime.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.rx;
+
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.FileRuntime;
+import spec.sdk.runtime.v1.domain.file.DelFileRequest;
+import spec.sdk.runtime.v1.domain.file.DelFileResponse;
+import spec.sdk.runtime.v1.domain.file.GetFileRequest;
+import spec.sdk.runtime.v1.domain.file.GetFileResponse;
+import spec.sdk.runtime.v1.domain.file.GetMetaRequest;
+import spec.sdk.runtime.v1.domain.file.GetMeteResponse;
+import spec.sdk.runtime.v1.domain.file.ListFileRequest;
+import spec.sdk.runtime.v1.domain.file.ListFileResponse;
+import spec.sdk.runtime.v1.domain.file.PutFileRequest;
+import spec.sdk.runtime.v1.domain.file.PutFileResponse;
+
+public interface FileRxRuntime extends FileRuntime {
+
+ /**
+ * save or update file
+ *
+ * @param request the put request
+ * @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
+ * @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
+ */
+ @Override
+ default PutFileResponse putFile(PutFileRequest request, int timeoutMs) throws Exception {
+ return putFileAsync(request, timeoutMs).block();
+ }
+
+ Mono putFileAsync(PutFileRequest request, int timeoutMs) throws Exception;
+
+ /**
+ * @param request the get request
+ * @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
+ * @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
+ */
+ @Override
+ default GetFileResponse getFile(GetFileRequest request, int timeoutMs) throws Exception {
+ return getFileAsync(request, timeoutMs).block();
+ }
+
+ Mono getFileAsync(GetFileRequest request, int timeoutMs) throws Exception;
+
+ /**
+ * @param request the list requset
+ * @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
+ * @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
+ */
+ @Override
+ default ListFileResponse listFile(ListFileRequest request, int timeoutMs) throws Exception {
+ return listFileAsync(request, timeoutMs).block();
+ }
+
+ Mono listFileAsync(ListFileRequest request, int timeoutMs) throws Exception;
+
+ /**
+ * @param request the del request
+ * @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
+ * @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
+ */
+ @Override
+ default DelFileResponse delFile(DelFileRequest request, int timeoutMs) throws Exception {
+ return delFileAsync(request, timeoutMs).block();
+ }
+
+ Mono delFileAsync(DelFileRequest request, int timeoutMs) throws Exception;
+
+ /**
+ * @param request the get meta request
+ * @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
+ * @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
+ */
+ @Override
+ default GetMeteResponse getFileMeta(GetMetaRequest request, int timeoutMs) throws Exception {
+ return getFileMetaAsync(request, timeoutMs).block();
+ }
+
+ Mono getFileMetaAsync(GetMetaRequest request, int timeoutMs) throws Exception;
+}
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/config/BooleanProperty.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/HelloRxRuntime.java
similarity index 54%
rename from sdk-reactor/src/main/java/io/mosn/layotto/v1/config/BooleanProperty.java
rename to sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/HelloRxRuntime.java
index d2211cd..6927ca2 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/config/BooleanProperty.java
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/HelloRxRuntime.java
@@ -12,25 +12,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.config;
+package spec.sdk.runtime.v1.domain.rx;
-/**
- * Boolean configuration property.
- */
-public class BooleanProperty extends Property {
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.HelloRuntime;
+
+public interface HelloRxRuntime extends HelloRuntime {
- /**
- * {@inheritDoc}
- */
- BooleanProperty(String name, String envName, Boolean defaultValue) {
- super(name, envName, defaultValue);
+ @Override
+ default String sayHello(String name) {
+ return sayHelloAsync(name).block();
}
- /**
- * {@inheritDoc}
- */
+ Mono sayHelloAsync(String name);
+
@Override
- protected Boolean parse(String value) {
- return Boolean.valueOf(value);
+ default String sayHello(String name, int timeoutMillisecond) {
+ return sayHelloAsync(name, timeoutMillisecond).block();
}
+
+ Mono sayHelloAsync(String name, int timeoutMillisecond);
}
diff --git a/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/InvocationRxRuntime.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/InvocationRxRuntime.java
new file mode 100644
index 0000000..93fcbc0
--- /dev/null
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/InvocationRxRuntime.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.rx;
+
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.invocation.InvokeResponse;
+
+import java.util.Map;
+
+public interface InvocationRxRuntime {
+
+ /**
+ * Invoke a service method.
+ *
+ * @param appId The Application ID where the service is.
+ * @param methodName The actual Method to be call in the application.
+ * @param data The data to be sent to invoke the service, use byte[] to skip serialization.
+ * @param header Metadata (in GRPC) or headers (in HTTP) to be sent in data.
+ * @return The response from the service call.
+ */
+ default InvokeResponse invokeMethod(String appId, String methodName, byte[] data, Map header) {
+ return invokeMethodAsync(appId, methodName, data, header).block();
+ }
+
+ Mono> invokeMethodAsync(String appId, String methodName, byte[] data, Map header);
+
+ /**
+ * Invoke a service method.
+ *
+ * @param appId The Application ID where the service is.
+ * @param methodName The actual Method to be call in the application.
+ * @param data The data to be sent to invoke the service, use byte[] to skip serialization.
+ * @param header Metadata (in GRPC) or headers (in HTTP) to be sent in data.
+ * @param timeoutMs can be customized every time a service method is called, since different services provide different SLA.
+ * @return The response from the service call.
+ */
+ default InvokeResponse invokeMethod(String appId, String methodName, byte[] data, Map header, int timeoutMs) {
+ return invokeMethodAsync(appId, methodName, data, header, timeoutMs).block();
+ }
+
+ Mono> invokeMethodAsync(String appId, String methodName, byte[] data, Map header, int timeoutMs);
+}
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/LockRxRuntime.java
similarity index 81%
rename from sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java
rename to sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/LockRxRuntime.java
index 223b264..efba20a 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/LockRxRuntime.java
@@ -12,12 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.value;
+package spec.sdk.runtime.v1.domain.rx;
-/**
- * Transport protocol for Layotto's API.
- */
-public enum LayottoApiProtocol {
+import spec.sdk.runtime.v1.domain.LockRuntime;
- GRPC;
+public interface LockRxRuntime extends LockRuntime {
}
diff --git a/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/PubSubRxRuntime.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/PubSubRxRuntime.java
new file mode 100644
index 0000000..b75626a
--- /dev/null
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/PubSubRxRuntime.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.rx;
+
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.PubSubRuntime;
+import spec.sdk.runtime.v1.domain.pubsub.PublishEventRequest;
+
+import java.util.Map;
+
+public interface PubSubRxRuntime extends PubSubRuntime {
+
+ /**
+ * Publish an event.
+ *
+ * @param pubsubName the pubsub name we will publish the event to
+ * @param topicName the topicName where the event will be published.
+ * @param data the event's data to be published, use byte[] for skipping serialization.
+ */
+ //void publishEvent(String pubsubName, String topicName, Object data);
+
+ /**
+ * Publish an event.
+ *
+ * @param pubsubName the pubsub name we will publish the event to
+ * @param topicName the topicName where the event will be published.
+ * @param data the event's data to be published, use byte[] for skipping serialization.
+ * @param metadata The metadata for the published event.
+ */
+ //void publishEvent(String pubsubName, String topicName, Object data, Map metadata);
+
+ /**
+ * Publish an event.
+ *
+ * @param pubsubName the pubsub name we will publish the event to
+ * @param topicName the topicName where the event will be published.
+ * @param data the event's data to be published, use byte[] for skipping serialization.
+ */
+ @Override
+ default void publishEvent(String pubsubName, String topicName, byte[] data) {
+ publishEventAsync(pubsubName, topicName, data).block();
+ }
+
+ Mono publishEventAsync(String pubsubName, String topicName, byte[] data);
+
+ @Override
+ default void publishEvent(String pubsubName, String topicName, byte[] data, Map metadata) {
+ publishEventAsync(pubsubName, topicName, data, metadata).block();
+ }
+
+ Mono publishEventAsync(String pubsubName, String topicName, byte[] data, Map metadata);
+
+ @Override
+ default void publishEvent(String pubsubName, String topicName, byte[] data, String contentType, Map metadata) {
+ publishEventAsync(pubsubName, topicName, data, contentType, metadata).block();
+ }
+
+ Mono publishEventAsync(String pubsubName, String topicName, byte[] data, String contentType, Map metadata);
+
+ @Override
+ default void publishEvent(PublishEventRequest request) {
+ publishEventAsync(request).block();
+ }
+
+ Mono publishEventAsync(PublishEventRequest request);
+}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/SequencerRxRuntime.java
similarity index 79%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
rename to sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/SequencerRxRuntime.java
index 49458e6..e64a3da 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/SequencerRxRuntime.java
@@ -12,10 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.runtime.v1.domain.lock;
+package spec.sdk.runtime.v1.domain.rx;
-public class UnlockRequest {
- public String storeName;
- public String resourceId;
- public String lockOwner;
+import spec.sdk.runtime.v1.domain.SequencerRuntime;
+
+public interface SequencerRxRuntime extends SequencerRuntime {
}
diff --git a/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/StateRxRuntime.java b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/StateRxRuntime.java
new file mode 100644
index 0000000..69309cc
--- /dev/null
+++ b/sdk-domain-rx/src/main/java/spec/sdk/runtime/v1/domain/rx/StateRxRuntime.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.rx;
+
+import reactor.core.publisher.Mono;
+import spec.sdk.runtime.v1.domain.StateRuntime;
+import spec.sdk.runtime.v1.domain.state.DeleteStateRequest;
+import spec.sdk.runtime.v1.domain.state.ExecuteStateTransactionRequest;
+import spec.sdk.runtime.v1.domain.state.GetBulkStateRequest;
+import spec.sdk.runtime.v1.domain.state.GetStateRequest;
+import spec.sdk.runtime.v1.domain.state.SaveStateRequest;
+import spec.sdk.runtime.v1.domain.state.State;
+import spec.sdk.runtime.v1.domain.state.StateOptions;
+import spec.sdk.runtime.v1.domain.state.TransactionalStateOperation;
+
+import java.util.List;
+import java.util.Map;
+
+public interface StateRxRuntime extends StateRuntime {
+
+ /**
+ * Retrieve a State based on their key.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the State to be retrieved.
+ * @param clazz The type of State needed as return.
+ * @param The type of the return.
+ */
+ @Override
+ default State getState(String storeName, String key, Class clazz) {
+ return getStateAsync(storeName, key, clazz).block();
+ }
+
+ Mono> getStateAsync(String storeName, String key, Class clazz);
+
+ /**
+ * Retrieve a State based on their key.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the State to be retrieved.
+ * @param options Optional settings for retrieve operation.
+ * @param clazz The Type of State needed as return.
+ * @param The Type of the return.
+ */
+ @Override
+ default State getState(String storeName, String key, StateOptions options, Class clazz) {
+ return getStateAsync(storeName, key, options, clazz).block();
+ }
+
+ Mono> getStateAsync(String storeName, String key, StateOptions options, Class clazz);
+
+ /**
+ * Retrieve a State based on their key.
+ *
+ * @param request The request to get state.
+ * @param clazz The Class of State needed as return.
+ * @param The Type of the return.
+ * @return The requested State.
+ */
+ @Override
+ default State getState(GetStateRequest request, Class clazz) {
+ return getStateAsync(request, clazz).block();
+ }
+
+ Mono> getStateAsync(GetStateRequest request, Class clazz);
+
+ /**
+ * Retrieve a State based on their key.
+ *
+ * @param request The request to get state.
+ * @param clazz The Class of State needed as return.
+ * @param timeoutMs timeout in milliseconds
+ * @param The Type of the return.
+ * @return the requested State.
+ */
+ @Override
+ default State getState(GetStateRequest request, Class clazz, int timeoutMs) {
+ return getStateAsync(request, clazz, timeoutMs).block();
+ }
+
+ Mono> getStateAsync(GetStateRequest request, Class clazz, int timeoutMs);
+
+ /**
+ * Retrieve bulk States based on their keys.
+ *
+ * @param storeName The name of the state store.
+ * @param keys The keys of the State to be retrieved.
+ * @param clazz The type of State needed as return.
+ * @param The type of the return.
+ */
+ @Override
+ default List> getBulkState(String storeName, List keys, Class clazz) {
+ return getBulkStateAsync(storeName, keys, clazz).block();
+ }
+
+ Mono>> getBulkStateAsync(String storeName, List keys, Class clazz);
+
+ /**
+ * Retrieve bulk States based on their keys.
+ *
+ * @param request The request to get state.
+ * @param clazz The Class of State needed as return.
+ * @param The Type of the return.
+ * @return The requested State.
+ */
+ @Override
+ default List> getBulkState(GetBulkStateRequest request, Class clazz) {
+ return getBulkStateAsync(request, clazz).block();
+ }
+
+ Mono>> getBulkStateAsync(GetBulkStateRequest request, Class clazz);
+
+ /**
+ * Retrieve bulk States based on their keys.
+ *
+ * @param request The request to get state.
+ * @param clazz The Class of State needed as return.
+ * @param The Type of the return.
+ * @param timeoutMs The time limit(millisecond) of this call.
+ * @return The requested State.
+ */
+ @Override
+ default List> getBulkState(GetBulkStateRequest request, Class clazz, int timeoutMs) {
+ return getBulkStateAsync(request, clazz, timeoutMs).block();
+ }
+
+ Mono>> getBulkStateAsync(GetBulkStateRequest request, Class clazz, int timeoutMs);
+
+ /**
+ * Execute a transaction.
+ *
+ * @param storeName The name of the state store.
+ * @param operations The operations to be performed.
+ */
+ @Override
+ default void executeStateTransaction(String storeName, List> operations) {
+ executeStateTransactionAsync(storeName, operations).block();
+ }
+
+ Mono executeStateTransactionAsync(String storeName, List> operations);
+
+ /**
+ * Execute a transaction.
+ *
+ * @param request Request to execute transaction.
+ */
+ @Override
+ default void executeStateTransaction(ExecuteStateTransactionRequest request) {
+ executeStateTransactionAsync(request).block();
+ }
+
+ Mono executeStateTransactionAsync(ExecuteStateTransactionRequest request);
+
+ /**
+ * Save/Update a list of states.
+ *
+ * @param storeName The name of the state store.
+ * @param states The States to be saved.
+ */
+ @Override
+ default void saveBulkState(String storeName, List> states) {
+ saveBulkStateAsync(storeName, states).block();
+ }
+
+ Mono saveBulkStateAsync(String storeName, List> states);
+
+ /**
+ * Save/Update a list of states.
+ *
+ * @param request Request to save states.
+ */
+ @Override
+ default void saveBulkState(SaveStateRequest request) {
+ saveBulkStateAsync(request).block();
+ }
+
+ Mono saveBulkStateAsync(SaveStateRequest request);
+
+ /**
+ * Save/Update a list of states.
+ *
+ * @param request Request to save bulk states.
+ * @param timeoutMs timeout in milliseconds
+ */
+ @Override
+ default void saveBulkState(SaveStateRequest request, int timeoutMs) {
+ saveBulkStateAsync(request, timeoutMs).block();
+ }
+
+ Mono saveBulkStateAsync(SaveStateRequest request, int timeoutMs);
+
+ /**
+ * Save/Update a state.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the state.
+ * @param value The value of the state.
+ */
+ @Override
+ default void saveState(String storeName, String key, Object value) {
+ saveStateAsync(storeName, key, value).block();
+ }
+
+ Mono saveStateAsync(String storeName, String key, Object value);
+
+ /**
+ * Save/Update a state.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the state.
+ * @param etag The etag to be used.
+ * @param value The value of the state.
+ * @param options The Options to use for each state.
+ */
+ @Override
+ default void saveState(String storeName, String key, String etag, Object value, StateOptions options, Map metadata) {
+ saveStateAsync(storeName, key, etag, value, options, metadata).block();
+ }
+
+ Mono saveStateAsync(String storeName, String key, String etag, Object value, StateOptions options, Map metadata);
+
+ /**
+ * Delete a state.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the State to be removed.
+ */
+ @Override
+ default void deleteState(String storeName, String key) {
+ deleteStateAsync(storeName, key).block();
+ }
+
+ Mono deleteStateAsync(String storeName, String key);
+
+ /**
+ * Delete a state.
+ *
+ * @param storeName The name of the state store.
+ * @param key The key of the State to be removed.
+ * @param etag Optional etag for conditional delete.
+ * @param options Optional settings for state operation.
+ */
+ @Override
+ default void deleteState(String storeName, String key, String etag, StateOptions options) {
+ deleteStateAsync(storeName, key, etag, options).block();
+ }
+
+ Mono deleteStateAsync(String storeName, String key, String etag, StateOptions options);
+
+ /**
+ * Delete a state.
+ *
+ * @param request Request to delete a state.
+ */
+ @Override
+ default void deleteState(DeleteStateRequest request) {
+ deleteStateAsync(request).block();
+ }
+
+ Mono deleteStateAsync(DeleteStateRequest request);
+
+ /**
+ * Delete a state.
+ *
+ * @param request Request to delete a state.
+ * @param timeoutMs timeout in milliseconds
+ */
+ @Override
+ default void deleteState(DeleteStateRequest request, int timeoutMs) {
+ deleteStateAsync(request, timeoutMs).block();
+ }
+
+ Mono deleteStateAsync(DeleteStateRequest request, int timeoutMs);
+}
diff --git a/sdk-domain/pom.xml b/sdk-domain/pom.xml
new file mode 100644
index 0000000..0f23428
--- /dev/null
+++ b/sdk-domain/pom.xml
@@ -0,0 +1,25 @@
+
+
+ 4.0.0
+
+
+ runtime-sdk-parent
+ io.mosn.layotto
+ 1.1.0-SNAPSHOT
+
+
+ runtime-sdk-domain
+ runtime-sdk-domain
+ Domain definition for Runtime
+ jar
+
+
+
+ io.mosn.layotto
+ runtime-sdk-infrastructure
+
+
+
+
\ No newline at end of file
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
new file mode 100644
index 0000000..e736a91
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain;
+
+import spec.sdk.runtime.v1.domain.configuration.ConfigurationItem;
+import spec.sdk.runtime.v1.domain.configuration.ConfigurationRequestItem;
+import spec.sdk.runtime.v1.domain.configuration.SaveConfigurationRequest;
+import spec.sdk.runtime.v1.domain.configuration.SubConfigurationResp;
+
+import java.util.List;
+
+public interface ConfigurationRuntime {
+
+ /**
+ * Gets configuration from configuration store
+ *
+ * @param configurationRequestItem Request object.
+ */
+ List getConfiguration(ConfigurationRequestItem configurationRequestItem);
+
+ /**
+ * Saves configuration into configuration store.
+ *ø
+ * @param saveConfigurationRequest Request object.
+ */
+ void saveConfiguration(SaveConfigurationRequest saveConfigurationRequest);
+
+ /**
+ * Deletes configuration from configuration store.
+ *
+ * @param configurationRequestItem Request object.
+ */
+ void deleteConfiguration(ConfigurationRequestItem configurationRequestItem);
+
+ /**
+ * Gets configuration from configuration store and subscribe the updates.
+ *
+ * @param configurationRequestItem Request object.
+ */
+ void subscribeConfiguration(ConfigurationRequestItem configurationRequestItem, Subscriber subscriber);
+
+ interface Subscriber {
+
+ /**
+ * Data notification sent by the {@code Publisher} in response to requests to {@link Subscription#request(long)}.
+ *
+ * @param t the element signaled
+ */
+ void onNext(SubConfigurationResp t);
+
+ /**
+ * Failed terminal state.
+ *
+ * @param t the throwable signaled
+ */
+ void onError(Throwable t);
+
+ /**
+ * Successful terminal state.
+ */
+ void onComplete();
+ }
+}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
similarity index 92%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
index b4c77db..82dd899 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
@@ -30,35 +30,35 @@ public interface FileRuntime {
/**
* save or update file
*
- * @param request
+ * @param request the put request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
PutFileResponse putFile(PutFileRequest request, int timeoutMs) throws Exception;
/**
- * @param request
+ * @param request the get request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
GetFileResponse getFile(GetFileRequest request, int timeoutMs) throws Exception;
/**
- * @param request
+ * @param request the list requset
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
ListFileResponse listFile(ListFileRequest request, int timeoutMs) throws Exception;
/**
- * @param request
+ * @param request the del request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
DelFileResponse delFile(DelFileRequest request, int timeoutMs) throws Exception;
/**
- * @param request
+ * @param request the get meta request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/HelloRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRuntime.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/HelloRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRuntime.java
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java
similarity index 60%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java
index 83e263f..4fc4923 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java
@@ -20,17 +20,26 @@
public interface InvocationRuntime {
+ /**
+ * Invoke a service method.
+ *
+ * @param appId The Application ID where the service is.
+ * @param methodName The actual Method to be call in the application.
+ * @param data The data to be sent to invoke the service, use byte[] to skip serialization.
+ * @param header Metadata (in GRPC) or headers (in HTTP) to be sent in data.
+ * @return The response from the service call.
+ */
InvokeResponse invokeMethod(String appId, String methodName, byte[] data, Map header);
/**
* Invoke a service method.
*
- * @param appId
- * @param methodName
- * @param data
- * @param header
+ * @param appId The Application ID where the service is.
+ * @param methodName The actual Method to be call in the application.
+ * @param data The data to be sent to invoke the service, use byte[] to skip serialization.
+ * @param header Metadata (in GRPC) or headers (in HTTP) to be sent in data.
* @param timeoutMs can be customized every time a service method is called, since different services provide different SLA.
- * @return
+ * @return The response from the service call.
*/
InvokeResponse invokeMethod(String appId, String methodName, byte[] data, Map header,
int timeoutMs);
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/LockRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/LockRuntime.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/LockRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/LockRuntime.java
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
similarity index 90%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
index 0f1b09c..92b1bfd 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
@@ -14,9 +14,12 @@
*/
package spec.sdk.runtime.v1.domain;
+import spec.sdk.runtime.v1.domain.pubsub.PublishEventRequest;
+
import java.util.Map;
public interface PubSubRuntime {
+
/**
* Publish an event.
*
@@ -49,4 +52,10 @@ public interface PubSubRuntime {
void publishEvent(String pubsubName, String topicName, byte[] data, String contentType, Map metadata);
+ /**
+ * Publish an event.
+ *
+ * @param request the request for the publish event.
+ */
+ void publishEvent(PublishEventRequest request);
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/SequencerRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRuntime.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/SequencerRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRuntime.java
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
similarity index 94%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
index 0480c99..8355a18 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
@@ -64,9 +64,9 @@ public interface StateRuntime {
*
* @param request The request to get state.
* @param clazz The Class of State needed as return.
- * @param timeoutMs
+ * @param timeoutMs timeout in milliseconds
* @param The Type of the return.
- * @return
+ * @return the requested State.
*/
State getState(GetStateRequest request, Class clazz, int timeoutMs);
@@ -107,8 +107,7 @@ public interface StateRuntime {
* @param storeName The name of the state store.
* @param operations The operations to be performed.
*/
- void executeStateTransaction(String storeName,
- List> operations);
+ void executeStateTransaction(String storeName, List> operations);
/**
* Execute a transaction.
@@ -135,8 +134,8 @@ void executeStateTransaction(String storeName,
/**
* Save/Update a list of states.
*
- * @param request
- * @param timeoutMs
+ * @param request Request to save bulk states.
+ * @param timeoutMs timeout in milliseconds
*/
void saveBulkState(SaveStateRequest request, int timeoutMs);
@@ -190,7 +189,7 @@ void saveState(String storeName, String key, String etag, Object value, StateOpt
* Delete a state.
*
* @param request Request to delete a state.
- * @param timeoutMs
+ * @param timeoutMs timeout in milliseconds
*/
void deleteState(DeleteStateRequest request, int timeoutMs);
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationItem.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
similarity index 79%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationItem.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
index a456d87..544f634 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationItem.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.configuration;
+package spec.sdk.runtime.v1.domain.configuration;
import java.util.Map;
-public class ConfigurationItem {
+public class ConfigurationItem {
/**
* Required. The key of configuration item
@@ -26,7 +26,7 @@ public class ConfigurationItem {
* The content of configuration item
* Empty if the configuration is not set, including the case that the configuration is changed from value-set to value-not-set.
*/
- private T content;
+ private Object content;
/**
* The group of configuration item.
*/
@@ -52,11 +52,11 @@ public void setKey(String key) {
this.key = key;
}
- public T getContent() {
+ public Object getContent() {
return content;
}
- public void setContent(T content) {
+ public void setContent(Object content) {
this.content = content;
}
@@ -91,4 +91,16 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "ConfigurationItem{" +
+ "key='" + key + '\'' +
+ ", content=" + content +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", tags=" + tags +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItem.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
similarity index 84%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItem.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
index 3c937dd..a9fe513 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItem.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.configuration;
+package spec.sdk.runtime.v1.domain.configuration;
import java.util.List;
import java.util.Map;
@@ -95,4 +95,16 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "ConfigurationRequestItem{" +
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", keys=" + keys +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItemBuilder.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
similarity index 82%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItemBuilder.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
index 1c2ad76..d026ba2 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/ConfigurationRequestItemBuilder.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.configuration;
+package spec.sdk.runtime.v1.domain.configuration;
import java.util.List;
import java.util.Map;
@@ -66,7 +66,7 @@ public ConfigurationRequestItemBuilder withMetadata(Map metadata
*/
public ConfigurationRequestItem build() {
ConfigurationRequestItem request = new ConfigurationRequestItem();
- request.setStoreName(this.appId);
+ request.setStoreName(this.storeName);
request.setAppId(this.appId);
request.setGroup(this.group);
request.setLabel(this.label);
@@ -74,4 +74,16 @@ public ConfigurationRequestItem build() {
request.setMetadata(this.metadata);
return request;
}
+
+ @Override
+ public String toString() {
+ return "ConfigurationRequestItemBuilder{" +
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", keys=" + keys +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SaveConfigurationRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
similarity index 80%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SaveConfigurationRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
index 9fc5cf6..09ab8f9 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SaveConfigurationRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.configuration;
+package spec.sdk.runtime.v1.domain.configuration;
import java.util.List;
import java.util.Map;
@@ -22,21 +22,21 @@ public class SaveConfigurationRequest {
/**
* The name of configuration store.
*/
- private String storeName;
+ private String storeName;
/**
* The application id which
* Only used for admin, Ignored and reset for normal client
*/
- private String appId;
+ private String appId;
/**
* The list of configuration items to save.
* To delete a exist item, set the key (also label) and let content to be empty
*/
- private List> items;
+ private List items;
/**
* The metadata which will be sent to configuration store components.
*/
- private Map metadata;
+ private Map metadata;
public String getStoreName() {
return storeName;
@@ -54,11 +54,11 @@ public void setAppId(String appId) {
this.appId = appId;
}
- public List> getItems() {
+ public List getItems() {
return items;
}
- public void setItems(List> items) {
+ public void setItems(List items) {
this.items = items;
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SubConfigurationResp.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
similarity index 69%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SubConfigurationResp.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
index 4fe44ae..19b9be8 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/configuration/SubConfigurationResp.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
@@ -12,26 +12,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.configuration;
+package spec.sdk.runtime.v1.domain.configuration;
import java.util.List;
-public class SubConfigurationResp {
+public class SubConfigurationResp {
/**
* The name of configuration store.
*/
- private String storeName;
+ private String storeName;
/**
* The application id which
* Only used for admin, Ignored and reset for normal client
*/
- private String appId;
+ private String appId;
/**
* The list of configuration items to save.
* To delete a exist item, set the key (also label) and let content to be empty
*/
- private List> items;
+ private List items;
public String getStoreName() {
return storeName;
@@ -49,11 +49,20 @@ public void setAppId(String appId) {
this.appId = appId;
}
- public List> getItems() {
+ public List getItems() {
return items;
}
- public void setItems(List> items) {
+ public void setItems(List items) {
this.items = items;
}
+
+ @Override
+ public String toString() {
+ return "SubConfigurationResp{" +
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", items=" + items +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java
index 79b8cf0..35afb53 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java
@@ -41,11 +41,9 @@ public void setFileName(String fileName) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
@@ -53,4 +51,12 @@ public void setMetaData(Map metaData) {
this.metaData = metaData;
}
+ @Override
+ public String toString() {
+ return "DelFileRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileResponse.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileResponse.java
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java
similarity index 87%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java
index a3a0ae6..8891609 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java
@@ -18,6 +18,7 @@
import java.util.Map;
public class FileInfo {
+
private String fileName;
private long size;
private String lastModified;
@@ -55,15 +56,23 @@ public void setLastModified(String lastModified) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
public void setMetaData(Map metaData) {
this.metaData = metaData;
}
+
+ @Override
+ public String toString() {
+ return "FileInfo{" +
+ "fileName='" + fileName + '\'' +
+ ", size=" + size +
+ ", lastModified='" + lastModified + '\'' +
+ ", metaData=" + metaData +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java
index 1d8e534..86bc760 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java
@@ -41,15 +41,22 @@ public void setFileName(String fileName) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
public void setMetaData(Map metaData) {
this.metaData = metaData;
}
+
+ @Override
+ public String toString() {
+ return "GetFileRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java
similarity index 87%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java
index 905e55c..21b4095 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java
@@ -31,4 +31,11 @@ public InputStream getIn() {
public void setIn(InputStream in) {
this.in = in;
}
+
+ @Override
+ public String toString() {
+ return "GetFileResponse{" +
+ "in=" + in +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java
index b1f856b..f7b071f 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java
@@ -41,15 +41,22 @@ public void setFileName(String fileName) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
public void setMetaData(Map metaData) {
this.metaData = metaData;
}
+
+ @Override
+ public String toString() {
+ return "GetMetaRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java
similarity index 99%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java
index 38553e7..c5782b0 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java
@@ -18,6 +18,7 @@
import java.util.Map;
public class GetMeteResponse {
+
private long size;
private String lastModified;
private Map meta;
@@ -39,11 +40,9 @@ public void setLastModified(String lastModified) {
}
public Map getMeta() {
-
if (meta == null) {
meta = new HashMap<>();
}
-
return meta;
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java
index 86ea4d8..d06d09d 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java
@@ -43,11 +43,9 @@ public void setName(String name) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
@@ -70,4 +68,15 @@ public String getMarker() {
public void setMarker(String marker) {
this.marker = marker;
}
+
+ @Override
+ public String toString() {
+ return "ListFileRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", name='" + name + '\'' +
+ ", metaData=" + metaData +
+ ", pageSize=" + pageSize +
+ ", marker='" + marker + '\'' +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java
similarity index 82%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java
index 23db57d..6f43170 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java
@@ -14,6 +14,8 @@
*/
package spec.sdk.runtime.v1.domain.file;
+import java.util.Arrays;
+
public class ListFileResponse {
private boolean isTruncated;
@@ -38,15 +40,22 @@ public void setMarker(String marker) {
}
public FileInfo[] getFiles() {
-
if (files == null) {
files = new FileInfo[0];
}
-
return files;
}
public void setFiles(FileInfo[] files) {
this.files = files;
}
+
+ @Override
+ public String toString() {
+ return "ListFileResponse{" +
+ "isTruncated=" + isTruncated +
+ ", marker='" + marker + '\'' +
+ ", files=" + Arrays.toString(files) +
+ '}';
+ }
}
\ No newline at end of file
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java
index fdef7c7..e705609 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java
@@ -44,11 +44,9 @@ public void setFileName(String fileName) {
}
public Map getMetaData() {
-
if (metaData == null) {
metaData = new HashMap<>();
}
-
return metaData;
}
@@ -63,4 +61,14 @@ public InputStream getIn() {
public void setIn(InputStream in) {
this.in = in;
}
+
+ @Override
+ public String toString() {
+ return "PutFileRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ ", in=" + in +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileResponse.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileResponse.java
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/HttpExtension.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
similarity index 81%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/HttpExtension.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
index 8a7a64e..9c0f38d 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/HttpExtension.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
@@ -12,14 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.invocation;
-
-import okhttp3.HttpUrl;
+package spec.sdk.runtime.v1.domain.invocation;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
/**
* HTTP Extension class.
@@ -124,27 +121,6 @@ public Map getHeaders() {
return headers;
}
- /**
- * Encodes the query string for the HTTP request.
- *
- * @return Encoded HTTP query string.
- */
- public String encodeQueryString() {
- if ((this.queryParams == null) || (this.queryParams.isEmpty())) {
- return "";
- }
-
- HttpUrl.Builder urlBuilder = new HttpUrl.Builder();
- // Setting required values but we only need query params in the end.
- urlBuilder.scheme("http").host("localhost");
- Optional.ofNullable(this.queryParams).orElse(Collections.emptyMap()).entrySet().stream()
- .forEach(urlParameter ->
- Optional.ofNullable(urlParameter.getValue()).orElse(Collections.emptyList()).stream()
- .forEach(urlParameterValue ->
- urlBuilder.addQueryParameter(urlParameter.getKey(), urlParameterValue)));
- return urlBuilder.build().encodedQuery();
- }
-
/**
* HTTP Methods supported.
*/
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/InvokeMethodRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
similarity index 82%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/InvokeMethodRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
index 696f3a5..aa69737 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/InvokeMethodRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.invocation;
+package spec.sdk.runtime.v1.domain.invocation;
import java.util.Map;
@@ -80,4 +80,16 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "InvokeMethodRequest{" +
+ "appId='" + appId + '\'' +
+ ", method='" + method + '\'' +
+ ", body=" + body +
+ ", httpExtension=" + httpExtension +
+ ", contentType='" + contentType + '\'' +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java
similarity index 89%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java
index 714c1fc..582ca95 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java
@@ -15,6 +15,7 @@
package spec.sdk.runtime.v1.domain.invocation;
public class InvokeResponse {
+
private String contentType;
private T data;
@@ -53,4 +54,12 @@ public T getData() {
public void setData(T data) {
this.data = data;
}
+
+ @Override
+ public String toString() {
+ return "InvokeResponse{" +
+ "contentType='" + contentType + '\'' +
+ ", data=" + data +
+ '}';
+ }
}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/Metadata.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/Metadata.java
similarity index 94%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/Metadata.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/Metadata.java
index 19c00a2..268bc45 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/invocation/Metadata.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/Metadata.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.core.invocation;
+package spec.sdk.runtime.v1.domain.invocation;
/**
* Enumerates commonly used metadata attributes.
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
new file mode 100644
index 0000000..35d03ec
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.lock;
+
+public class TryLockRequest {
+
+ public String storeName;
+ public String resourceId;
+ public String lockOwner;
+ public int expire;
+
+ public String getStoreName() {
+ return storeName;
+ }
+
+ public void setStoreName(String storeName) {
+ this.storeName = storeName;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getLockOwner() {
+ return lockOwner;
+ }
+
+ public void setLockOwner(String lockOwner) {
+ this.lockOwner = lockOwner;
+ }
+
+ public int getExpire() {
+ return expire;
+ }
+
+ public void setExpire(int expire) {
+ this.expire = expire;
+ }
+
+ @Override
+ public String toString() {
+ return "TryLockRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", resourceId='" + resourceId + '\'' +
+ ", lockOwner='" + lockOwner + '\'' +
+ ", expire=" + expire +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
similarity index 65%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
index a12f819..3f4a6e7 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
@@ -14,18 +14,22 @@
*/
package spec.sdk.runtime.v1.domain.lock;
-enum UnlockResponseStatus {
- SUCCESS(0),
- LOCK_UNEXIST(1),
- LOCK_BELONG_TO_OTHERS(2),
- INTERNAL_ERROR(3);
- private final int value;
+public class TryLockResponse {
- UnlockResponseStatus(int value) {
- this.value = value;
+ public boolean success;
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
}
-}
-public class UnlockResponse {
- public UnlockResponseStatus status;
-}
+ @Override
+ public String toString() {
+ return "TryLockResponse{" +
+ "success=" + success +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
new file mode 100644
index 0000000..437147f
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.lock;
+
+public class UnlockRequest {
+
+ public String storeName;
+ public String resourceId;
+ public String lockOwner;
+
+ public String getStoreName() {
+ return storeName;
+ }
+
+ public void setStoreName(String storeName) {
+ this.storeName = storeName;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getLockOwner() {
+ return lockOwner;
+ }
+
+ public void setLockOwner(String lockOwner) {
+ this.lockOwner = lockOwner;
+ }
+
+ @Override
+ public String toString() {
+ return "UnlockRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", resourceId='" + resourceId + '\'' +
+ ", lockOwner='" + lockOwner + '\'' +
+ '}';
+ }
+}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java
new file mode 100644
index 0000000..ea67658
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2021 Layotto Authors
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package spec.sdk.runtime.v1.domain.lock;
+
+public class UnlockResponse {
+
+ public UnlockResponseStatus status;
+
+ public UnlockResponseStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(UnlockResponseStatus status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "UnlockResponse{" +
+ "status=" + status +
+ '}';
+ }
+
+ public enum UnlockResponseStatus {
+
+ SUCCESS(0),
+ LOCK_UNEXIST(1),
+ LOCK_BELONG_TO_OTHERS(2),
+ INTERNAL_ERROR(3);
+
+ private final int value;
+
+ UnlockResponseStatus(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+ }
+}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
similarity index 74%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
index 9dcfbc5..97d0b69 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
@@ -12,11 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.runtime.v1.domain.lock;
-
-public class TryLockRequest {
- public String storeName;
- public String resourceId;
- public String lockOwner;
- public int expire;
-}
\ No newline at end of file
+/**
+ * This package was copied from [cloud-runtimes-jvm](https://github.com/reactivegroup/cloud-runtimes-jvm)
+ * and [Dapr java sdk](https://github.com/dapr/java-sdk)
+ */
+package spec.sdk.runtime.v1.domain;
\ No newline at end of file
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java
similarity index 89%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java
index 3d7fe28..a3cae43 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java
@@ -14,9 +14,11 @@
*/
package spec.sdk.runtime.v1.domain.pubsub;
+import java.util.Arrays;
import java.util.Map;
public class PublishEventRequest {
+
// The name of the pubsub component
private String pubsubName;
// The pubsub topic
@@ -122,4 +124,15 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "PublishEventRequest{" +
+ "pubsubName='" + pubsubName + '\'' +
+ ", topic='" + topic + '\'' +
+ ", data=" + Arrays.toString(data) +
+ ", contentType='" + contentType + '\'' +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java
similarity index 91%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java
index e907584..3888b96 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java
@@ -14,9 +14,11 @@
*/
package spec.sdk.runtime.v1.domain.pubsub;
+import java.util.Arrays;
import java.util.Map;
public class TopicEventRequest {
+
// id identifies the event. Producers MUST ensure that source + id
// is unique for each distinct event. If a duplicate event is re-sent
// (e.g. due to a network error) it MAY have the same id.
@@ -211,4 +213,19 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "TopicEventRequest{" +
+ "id='" + id + '\'' +
+ ", source='" + source + '\'' +
+ ", type='" + type + '\'' +
+ ", specVersion='" + specVersion + '\'' +
+ ", contentType='" + contentType + '\'' +
+ ", data=" + Arrays.toString(data) +
+ ", topic='" + topic + '\'' +
+ ", pubsubName='" + pubsubName + '\'' +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java
similarity index 88%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java
index 13272da..89a8ecf 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java
@@ -15,6 +15,7 @@
package spec.sdk.runtime.v1.domain.pubsub;
public class TopicEventResponse {
+
private TopicEventResponseStatus status;
/**
@@ -34,4 +35,11 @@ public TopicEventResponseStatus getStatus() {
public void setStatus(TopicEventResponseStatus status) {
this.status = status;
}
+
+ @Override
+ public String toString() {
+ return "TopicEventResponse{" +
+ "status=" + status +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java
similarity index 99%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java
index e59c760..bed3418 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java
@@ -16,6 +16,7 @@
// TopicEventResponseStatus allows apps to have finer control over handling of the message.
public enum TopicEventResponseStatus {
+
// SUCCESS is the default behavior: message is acknowledged and not retried or logged.
SUCCESS(0),
// RETRY status signals runtime to retry the message as part of an expected scenario (no warning is logged).
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java
similarity index 90%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java
index dcd8603..2795b37 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java
@@ -17,6 +17,7 @@
import java.util.Map;
public class TopicSubscription {
+
// Required. The name of the pubsub containing the topic below to subscribe to.
private String pubsubName;
@@ -79,4 +80,13 @@ public Map getMetadata() {
public void setMetadata(Map metadata) {
this.metadata = metadata;
}
+
+ @Override
+ public String toString() {
+ return "TopicSubscription{" +
+ "pubsubName='" + pubsubName + '\'' +
+ ", topic='" + topic + '\'' +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java
similarity index 83%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java
index 3223b21..81aa9f2 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java
@@ -64,8 +64,12 @@ public void setMetadata(Map metadata) {
}
public void putMetadata(String key, String value) {
- if (key == null) { throw new java.lang.NullPointerException(); }
- if (value == null) { throw new java.lang.NullPointerException(); }
+ if (key == null) {
+ throw new java.lang.NullPointerException();
+ }
+ if (value == null) {
+ throw new java.lang.NullPointerException();
+ }
if (metadata == null) {
metadata = new HashMap<>();
}
@@ -107,4 +111,15 @@ public StateOptions getStateOptions() {
public void setStateOptions(StateOptions stateOptions) {
this.stateOptions = stateOptions;
}
+
+ @Override
+ public String toString() {
+ return "DeleteStateRequest{" +
+ "stateStoreName='" + stateStoreName + '\'' +
+ ", key='" + key + '\'' +
+ ", metadata=" + metadata +
+ ", etag='" + etag + '\'' +
+ ", stateOptions=" + stateOptions +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java
similarity index 83%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java
index 0b21f4c..2a28a54 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java
@@ -80,12 +80,24 @@ public void setMetadata(Map metadata) {
}
public void putMetadata(String key, String value) {
- if (key == null) { throw new java.lang.NullPointerException(); }
- if (value == null) { throw new java.lang.NullPointerException(); }
+ if (key == null) {
+ throw new java.lang.NullPointerException();
+ }
+ if (value == null) {
+ throw new java.lang.NullPointerException();
+ }
if (metadata == null) {
metadata = new HashMap<>();
}
metadata.put(key, value);
}
+ @Override
+ public String toString() {
+ return "ExecuteStateTransactionRequest{" +
+ "stateStoreName='" + stateStoreName + '\'' +
+ ", operations=" + operations +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java
similarity index 84%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java
index fed07d6..4af9e51 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java
@@ -70,8 +70,12 @@ public void setMetadata(Map metadata) {
}
public void putMetadata(String key, String value) {
- if (key == null) { throw new java.lang.NullPointerException(); }
- if (value == null) { throw new java.lang.NullPointerException(); }
+ if (key == null) {
+ throw new java.lang.NullPointerException();
+ }
+ if (value == null) {
+ throw new java.lang.NullPointerException();
+ }
if (metadata == null) {
metadata = new HashMap<>();
}
@@ -95,4 +99,14 @@ public int getParallelism() {
public void setParallelism(int parallelism) {
this.parallelism = parallelism;
}
+
+ @Override
+ public String toString() {
+ return "GetBulkStateRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", keys=" + keys +
+ ", metadata=" + metadata +
+ ", parallelism=" + parallelism +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java
similarity index 82%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java
index e6443c3..27ddbf2 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java
@@ -62,8 +62,12 @@ public void setMetadata(Map metadata) {
}
public void putMetadata(String key, String value) {
- if (key == null) { throw new java.lang.NullPointerException(); }
- if (value == null) { throw new java.lang.NullPointerException(); }
+ if (key == null) {
+ throw new java.lang.NullPointerException();
+ }
+ if (value == null) {
+ throw new java.lang.NullPointerException();
+ }
if (metadata == null) {
metadata = new HashMap<>();
}
@@ -87,4 +91,14 @@ public StateOptions getStateOptions() {
public void setStateOptions(StateOptions stateOptions) {
this.stateOptions = stateOptions;
}
+
+ @Override
+ public String toString() {
+ return "GetStateRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", key='" + key + '\'' +
+ ", metadata=" + metadata +
+ ", stateOptions=" + stateOptions +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java
similarity index 88%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java
index 9885b85..e3075f8 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java
@@ -50,4 +50,12 @@ public List> getStates() {
public void setStates(List> states) {
this.states = states;
}
+
+ @Override
+ public String toString() {
+ return "SaveStateRequest{" +
+ "storeName='" + storeName + '\'' +
+ ", states=" + states +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/State.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/State.java
similarity index 94%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/State.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/State.java
index 88c2619..6b05b81 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/State.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/State.java
@@ -204,4 +204,16 @@ public StateOptions getOptions() {
public String getError() {
return error;
}
+
+ @Override
+ public String toString() {
+ return "State{" +
+ "key='" + key + '\'' +
+ ", value=" + value +
+ ", etag='" + etag + '\'' +
+ ", metadata=" + metadata +
+ ", error='" + error + '\'' +
+ ", options=" + options +
+ '}';
+ }
}
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java
similarity index 91%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java
index 97b9868..777f81d 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java
@@ -15,11 +15,13 @@
package spec.sdk.runtime.v1.domain.state;
public class StateOptions {
+
private final Consistency consistency;
private final Concurrency concurrency;
/**
* Represents options for a state API call.
+ *
* @param consistency The consistency mode.
* @param concurrency The concurrency mode.
*/
@@ -36,7 +38,16 @@ public Consistency getConsistency() {
return consistency;
}
+ @Override
+ public String toString() {
+ return "StateOptions{" +
+ "consistency=" + consistency +
+ ", concurrency=" + concurrency +
+ '}';
+ }
+
public enum Consistency {
+
EVENTUAL("eventual"),
STRONG("strong");
@@ -56,6 +67,7 @@ public static Consistency fromValue(String value) {
}
public enum Concurrency {
+
FIRST_WRITE("first-write"),
LAST_WRITE("last-write");
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java
similarity index 88%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java
index 05c3954..88eba26 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java
@@ -45,6 +45,14 @@ public State getRequest() {
return request;
}
+ @Override
+ public String toString() {
+ return "TransactionalStateOperation{" +
+ "operation=" + operation +
+ ", request=" + request +
+ '}';
+ }
+
public enum OperationType {
UPSERT,
DELETE
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java
similarity index 90%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java
index fdd0bc7..7a0e3e9 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java
@@ -58,4 +58,12 @@ public void putMetadata(String key, String value) {
}
metadata.put(key, value);
}
+
+ @Override
+ public String toString() {
+ return "TransactionalStateRequest{" +
+ "operations=" + operations +
+ ", metadata=" + metadata +
+ '}';
+ }
}
diff --git a/sdk-grpc/pom.xml b/sdk-grpc/pom.xml
new file mode 100644
index 0000000..8b15b85
--- /dev/null
+++ b/sdk-grpc/pom.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+
+ runtime-sdk-parent
+ io.mosn.layotto
+ 1.1.0-SNAPSHOT
+
+
+ runtime-sdk-grpc
+ runtime-sdk-grpc
+ grpc client for Runtime
+ jar
+
+
+
+ io.mosn.layotto
+ runtime-spec-pb
+
+
+ io.mosn.layotto
+ runtime-sdk-domain
+
+
+
\ No newline at end of file
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/ExceptionHandler.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/ExceptionHandler.java
similarity index 100%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/ExceptionHandler.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/ExceptionHandler.java
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/callback/GrpcAppCallbackImpl.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/GrpcAppCallbackImpl.java
similarity index 93%
rename from sdk/src/main/java/io/mosn/layotto/v1/callback/GrpcAppCallbackImpl.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/GrpcAppCallbackImpl.java
index 3254c0d..a53989b 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/callback/GrpcAppCallbackImpl.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/GrpcAppCallbackImpl.java
@@ -12,13 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.callback;
+package io.mosn.layotto.v1.grpc.callback;
import com.google.protobuf.Empty;
import io.grpc.stub.StreamObserver;
-import io.mosn.layotto.v1.callback.component.pubsub.Subscriber;
-import io.mosn.layotto.v1.callback.component.pubsub.SubscriberRegistry;
-import io.mosn.layotto.v1.grpc.PubsubConverter;
+import io.mosn.layotto.v1.grpc.callback.component.pubsub.Subscriber;
+import io.mosn.layotto.v1.grpc.callback.component.pubsub.SubscriberRegistry;
+import io.mosn.layotto.v1.grpc.converter.PubsubConverter;
import spec.proto.runtime.v1.AppCallbackGrpc;
import spec.proto.runtime.v1.AppCallbackProto;
import spec.sdk.runtime.v1.domain.pubsub.TopicEventResponse;
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/Component.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/Component.java
similarity index 92%
rename from sdk/src/main/java/io/mosn/layotto/v1/callback/component/Component.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/Component.java
index f105e03..07ebd71 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/Component.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/Component.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.callback.component;
+package io.mosn.layotto.v1.grpc.callback.component;
public interface Component {
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/Subscriber.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/Subscriber.java
similarity index 89%
rename from sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/Subscriber.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/Subscriber.java
index 21e683d..746162a 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/Subscriber.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/Subscriber.java
@@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.callback.component.pubsub;
+package io.mosn.layotto.v1.grpc.callback.component.pubsub;
-import io.mosn.layotto.v1.callback.component.Component;
+import io.mosn.layotto.v1.grpc.callback.component.Component;
import spec.sdk.runtime.v1.domain.pubsub.TopicEventRequest;
import spec.sdk.runtime.v1.domain.pubsub.TopicEventResponse;
import spec.sdk.runtime.v1.domain.pubsub.TopicSubscription;
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistry.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistry.java
similarity index 93%
rename from sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistry.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistry.java
index aaa36be..be705ab 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistry.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistry.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.callback.component.pubsub;
+package io.mosn.layotto.v1.grpc.callback.component.pubsub;
import java.util.Collection;
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistryImpl.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistryImpl.java
similarity index 97%
rename from sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistryImpl.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistryImpl.java
index 155995b..729679c 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/callback/component/pubsub/SubscriberRegistryImpl.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/callback/component/pubsub/SubscriberRegistryImpl.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.callback.component.pubsub;
+package io.mosn.layotto.v1.grpc.callback.component.pubsub;
import java.util.Collection;
import java.util.HashSet;
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/PubsubConverter.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/converter/PubsubConverter.java
similarity index 99%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/PubsubConverter.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/converter/PubsubConverter.java
index 320cc44..93b1f4c 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/grpc/PubsubConverter.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/converter/PubsubConverter.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.grpc;
+package io.mosn.layotto.v1.grpc.converter;
import com.google.protobuf.ByteString;
import spec.proto.runtime.v1.AppCallbackProto;
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
similarity index 88%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
index 89ba2c7..9f57d34 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
@@ -12,7 +12,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.runtime.v1.domain;
-
-public interface ConfigurationRuntime {
-}
+package io.mosn.layotto.v1.grpc;
\ No newline at end of file
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/PooledStubManager.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/PooledStubManager.java
similarity index 100%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/PooledStubManager.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/PooledStubManager.java
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java
similarity index 99%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java
index d0fea1b..03a9b66 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java
@@ -23,6 +23,7 @@
* @param
*/
public class RRPool {
+
private final List stubs;
private final RRIndex idx;
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/SingleStubManager.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/SingleStubManager.java
similarity index 100%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/SingleStubManager.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/SingleStubManager.java
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java
similarity index 99%
rename from sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java
index 7b4a471..c2cb8ab 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java
@@ -23,5 +23,4 @@ public interface StubCreator
+
+ 4.0.0
+
+
+ runtime-sdk-parent
+ io.mosn.layotto
+ 1.1.0-SNAPSHOT
+
+
+ runtime-sdk-infrastructure
+ runtime-sdk-infrastructure
+ infrastructure for Runtime
+ jar
+
+
\ No newline at end of file
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/config/RuntimeProperties.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/config/RuntimeProperties.java
similarity index 89%
rename from sdk/src/main/java/io/mosn/layotto/v1/config/RuntimeProperties.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/config/RuntimeProperties.java
index 4f09bad..d537a3b 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/config/RuntimeProperties.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/config/RuntimeProperties.java
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.config;
+package io.mosn.layotto.v1.infrastructure.config;
-import io.mosn.layotto.v1.domain.ApiProtocol;
+import io.mosn.layotto.v1.infrastructure.value.ApiProtocol;
-public class RuntimeProperties {
+public final class RuntimeProperties {
/**
* Layotto Runtimes default use of GRPC.
@@ -42,5 +42,4 @@ public class RuntimeProperties {
* Layotto Runtimes default pubsub content type.
*/
public static final String DEFAULT_PUBSUB_CONTENT_TYPE = "";
-
}
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeClientException.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeClientException.java
similarity index 98%
rename from sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeClientException.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeClientException.java
index 92ebf6b..65fb7ed 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeClientException.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeClientException.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.exceptions;
+package io.mosn.layotto.v1.infrastructure.exceptions;
/**
* A Runtime's specific exception.
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeError.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeError.java
similarity index 95%
rename from sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeError.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeError.java
index ff2fe00..0240f3f 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/exceptions/RuntimeError.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/exceptions/RuntimeError.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.exceptions;
+package io.mosn.layotto.v1.infrastructure.exceptions;
public enum RuntimeError {
;
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
similarity index 85%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
index 30a4dbb..e870801 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
@@ -12,8 +12,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.runtime.v1.domain.lock;
-
-public class TryLockResponse {
- public boolean success;
-}
\ No newline at end of file
+package io.mosn.layotto.v1.infrastructure;
\ No newline at end of file
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/serializer/AbstractSerializer.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/AbstractSerializer.java
similarity index 96%
rename from sdk/src/main/java/io/mosn/layotto/v1/serializer/AbstractSerializer.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/AbstractSerializer.java
index ad1da68..074ad4d 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/serializer/AbstractSerializer.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/AbstractSerializer.java
@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.serializer;
+package io.mosn.layotto.v1.infrastructure.serializer;
import java.io.IOException;
public abstract class AbstractSerializer implements ObjectSerializer {
+
/**
* {@inheritDoc}
*/
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/serializer/ObjectSerializer.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/ObjectSerializer.java
similarity index 96%
rename from sdk/src/main/java/io/mosn/layotto/v1/serializer/ObjectSerializer.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/ObjectSerializer.java
index db3950f..6af4f53 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/serializer/ObjectSerializer.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/serializer/ObjectSerializer.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.serializer;
+package io.mosn.layotto.v1.infrastructure.serializer;
import java.io.IOException;
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/utils/NetworkUtils.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/utils/NetworkUtils.java
similarity index 96%
rename from sdk-reactor/src/main/java/io/mosn/layotto/v1/utils/NetworkUtils.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/utils/NetworkUtils.java
index 4faa324..c6fed75 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/utils/NetworkUtils.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/utils/NetworkUtils.java
@@ -12,14 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.utils;
+package io.mosn.layotto.v1.infrastructure.utils;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
/**
- * Utility methods for network, internal to Dapr SDK.
+ * Utility methods for network, internal to Layotto SDK.
*/
public final class NetworkUtils {
diff --git a/sdk/src/main/java/io/mosn/layotto/v1/domain/ApiProtocol.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/ApiProtocol.java
similarity index 93%
rename from sdk/src/main/java/io/mosn/layotto/v1/domain/ApiProtocol.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/ApiProtocol.java
index a194d33..c3e98ee 100644
--- a/sdk/src/main/java/io/mosn/layotto/v1/domain/ApiProtocol.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/ApiProtocol.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.domain;
+package io.mosn.layotto.v1.infrastructure.value;
/**
* Transport protocol for Runtime API.
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/value/Headers.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/Headers.java
similarity index 95%
rename from sdk-reactor/src/main/java/io/mosn/layotto/v1/value/Headers.java
rename to sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/Headers.java
index c8b9cde..66f027e 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/value/Headers.java
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value/Headers.java
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.mosn.layotto.v1.value;
+package io.mosn.layotto.v1.infrastructure.value;
/**
* Common headers for GRPC and HTTP communication.
diff --git a/sdk-reactor/pom.xml b/sdk-reactor/pom.xml
index ae43a86..60ca179 100644
--- a/sdk-reactor/pom.xml
+++ b/sdk-reactor/pom.xml
@@ -11,43 +11,52 @@
runtime-sdk-reactor
-
runtime-sdk-reactor
reactor-style SDK for Runtime
jar
+
+ 6.0.53
+ 4.9.3
+ 2.13.0
+
+
io.mosn.layotto
- runtime-spec-pb
+ runtime-sdk-grpc
- org.slf4j
- slf4j-api
+ io.mosn.layotto
+ runtime-sdk-domain-rx
+
- io.projectreactor
- reactor-core
- 3.3.11.RELEASE
+ org.slf4j
+ slf4j-api
+
com.fasterxml.jackson.core
jackson-databind
- 2.11.3
+ ${jackson-databind.version}
+
com.squareup.okhttp3
okhttp
- 4.9.0
+ ${okhttp.version}
+
org.apache.tomcat
annotations-api
- 6.0.53
+ ${annotations-api.version}
provided
+
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/AbstractLayottoReactorClient.java b/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/AbstractLayottoReactorClient.java
deleted file mode 100644
index bca2ae6..0000000
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/AbstractLayottoReactorClient.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright 2021 Layotto Authors
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.mosn.layotto.v1.client.reactor;
-
-import io.mosn.layotto.v1.serializer.LayottoObjectSerializer;
-import reactor.core.publisher.Mono;
-import spec.sdk.reactor.v1.domain.core.invocation.HttpExtension;
-import spec.sdk.reactor.v1.domain.core.invocation.InvokeMethodRequest;
-import spec.sdk.reactor.v1.domain.core.pubsub.PublishEventRequest;
-import spec.sdk.reactor.v1.domain.core.state.DeleteStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.ExecuteStateTransactionRequest;
-import spec.sdk.reactor.v1.domain.core.state.GetBulkStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.GetStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.SaveStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.State;
-import spec.sdk.reactor.v1.domain.core.state.StateOptions;
-import spec.sdk.reactor.v1.domain.core.state.TransactionalStateOperation;
-import spec.sdk.reactor.v1.utils.TypeRef;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-abstract class AbstractLayottoReactorClient implements LayottoReactorClient {
-
- /**
- * A utility class for serialize and deserialize the transient objects.
- */
- protected LayottoObjectSerializer objectSerializer;
-
- /**
- * A utility class for serialize and deserialize state objects.
- */
- protected LayottoObjectSerializer stateSerializer;
-
- /**
- * Common constructor for implementations of this class.
- *
- * @param objectSerializer Serializer for transient request/response objects.
- * @param stateSerializer Serializer for state objects.
- */
- AbstractLayottoReactorClient(LayottoObjectSerializer objectSerializer,
- LayottoObjectSerializer stateSerializer) {
- this.objectSerializer = objectSerializer;
- this.stateSerializer = stateSerializer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono publishEvent(String pubsubName, String topicName, Object data) {
- return this.publishEvent(pubsubName, topicName, data, null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono publishEvent(String pubsubName, String topicName, Object data, Map metadata) {
- PublishEventRequest req = new PublishEventRequest(pubsubName, topicName, data)
- .setMetadata(metadata);
- return this.publishEvent(req).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId,
- String methodName,
- Object data,
- HttpExtension httpExtension,
- Map metadata,
- TypeRef type) {
- InvokeMethodRequest req = new InvokeMethodRequest(appId, methodName)
- .setBody(data)
- .setHttpExtension(httpExtension)
- .setContentType(objectSerializer.getContentType());
- return this.invokeMethod(req, type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId,
- String methodName,
- Object request,
- HttpExtension httpExtension,
- Map metadata,
- Class clazz) {
- return this.invokeMethod(appId, methodName, request, httpExtension, metadata, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension,
- Map metadata, TypeRef type) {
- return this.invokeMethod(appId, methodName, null, httpExtension, metadata, type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension,
- Map metadata, Class clazz) {
- return this.invokeMethod(appId, methodName, null, httpExtension, metadata, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
- TypeRef type) {
- return this.invokeMethod(appId, methodName, request, httpExtension, null, type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
- Class clazz) {
- return this.invokeMethod(appId, methodName, request, httpExtension, null, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension) {
- return this.invokeMethod(appId, methodName, request, httpExtension, null, TypeRef.BYTE_ARRAY).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
- Map metadata) {
- return this.invokeMethod(appId, methodName, request, httpExtension, metadata, TypeRef.BYTE_ARRAY).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, HttpExtension httpExtension,
- Map metadata) {
- return this.invokeMethod(appId, methodName, null, httpExtension, metadata, TypeRef.BYTE_ARRAY).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono invokeMethod(String appId, String methodName, byte[] request, HttpExtension httpExtension,
- Map metadata) {
- return this.invokeMethod(appId, methodName, request, httpExtension, metadata, TypeRef.BYTE_ARRAY);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, State state, TypeRef type) {
- return this.getState(storeName, state.getKey(), state.getOptions(), type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, State state, Class clazz) {
- return this.getState(storeName, state.getKey(), state.getOptions(), TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, String key, TypeRef type) {
- return this.getState(storeName, key, null, type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, String key, Class clazz) {
- return this.getState(storeName, key, null, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, String key, StateOptions options, TypeRef type) {
- GetStateRequest request = new GetStateRequest(storeName, key)
- .setStateOptions(options);
- return this.getState(request, type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono> getState(String storeName, String key, StateOptions options, Class clazz) {
- return this.getState(storeName, key, options, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono>> getBulkState(String storeName, List keys, TypeRef type) {
- return this.getBulkState(new GetBulkStateRequest(storeName, keys), type);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono>> getBulkState(String storeName, List keys, Class clazz) {
- return this.getBulkState(storeName, keys, TypeRef.get(clazz));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono executeStateTransaction(String storeName, List> operations) {
- ExecuteStateTransactionRequest request = new ExecuteStateTransactionRequest(storeName)
- .setOperations(operations);
- return executeStateTransaction(request).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono saveBulkState(String storeName, List> states) {
- SaveStateRequest request = new SaveStateRequest(storeName)
- .setStates(states);
- return this.saveBulkState(request).then();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono saveState(String storeName, String key, Object value) {
- return this.saveState(storeName, key, null, value, null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono saveState(String storeName, String key, String etag, Object value, StateOptions options) {
- State> state = new State<>(key, value, etag, options);
- return this.saveBulkState(storeName, Collections.singletonList(state));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono deleteState(String storeName, String key) {
- return this.deleteState(storeName, key, null, null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Mono deleteState(String storeName, String key, String etag, StateOptions options) {
- DeleteStateRequest request = new DeleteStateRequest(storeName, key)
- .setEtag(etag)
- .setStateOptions(options);
- return deleteState(request).then();
- }
-}
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClient.java b/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClient.java
deleted file mode 100644
index dc8ea27..0000000
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClient.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2021 Layotto Authors
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.mosn.layotto.v1.client.reactor;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import spec.sdk.reactor.v1.client.CloudRuntimesClient;
-import spec.sdk.reactor.v1.domain.core.configuration.ConfigurationItem;
-import spec.sdk.reactor.v1.domain.core.configuration.ConfigurationRequestItem;
-import spec.sdk.reactor.v1.domain.core.configuration.SaveConfigurationRequest;
-import spec.sdk.reactor.v1.domain.core.configuration.SubConfigurationResp;
-import spec.sdk.reactor.v1.domain.core.invocation.HttpExtension;
-import spec.sdk.reactor.v1.domain.core.invocation.InvokeMethodRequest;
-import spec.sdk.reactor.v1.domain.core.pubsub.PublishEventRequest;
-import spec.sdk.reactor.v1.domain.core.state.DeleteStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.ExecuteStateTransactionRequest;
-import spec.sdk.reactor.v1.domain.core.state.GetBulkStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.GetStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.SaveStateRequest;
-import spec.sdk.reactor.v1.domain.core.state.State;
-import spec.sdk.reactor.v1.domain.core.state.StateOptions;
-import spec.sdk.reactor.v1.domain.core.state.TransactionalStateOperation;
-import spec.sdk.reactor.v1.utils.TypeRef;
-
-import java.util.List;
-import java.util.Map;
-
-public interface LayottoReactorClient extends CloudRuntimesClient {
-
- @Override
- Mono waitForSidecar(int timeoutInMilliseconds);
-
- @Override
- Mono shutdown();
-
- @Override
- void close() throws Exception;
-
- @Override
- Mono>> getConfiguration(ConfigurationRequestItem configurationRequestItem,
- TypeRef type);
-
- @Override
- Mono saveConfiguration(SaveConfigurationRequest saveConfigurationRequest);
-
- @Override
- Mono deleteConfiguration(ConfigurationRequestItem configurationRequestItem);
-
- @Override
- Flux> subscribeConfiguration(ConfigurationRequestItem configurationRequestItem,
- TypeRef type);
-
- @Override
- Mono invokeMethod(String appId, String methodName, Object data, HttpExtension httpExtension,
- Map metadata, TypeRef type);
-
- @Override
- Mono invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
- Map metadata, Class clazz);
-
- @Override
-