From 320ff1edea76eae7a7b712335e4480af099511c8 Mon Sep 17 00:00:00 2001
From: kevinten <596823919@qq.com>
Date: Wed, 8 Dec 2021 23:57:53 +0800
Subject: [PATCH 1/3] feat: https://github.com/layotto/java-sdk/issues/3 and
https://github.com/layotto/java-sdk/issues/1
---
examples/pom.xml | 1 +
pom.xml | 18 +-
sdk-domain/pom.xml | 31 ++
.../v1/domain/ConfigurationRuntime.java | 0
.../sdk/runtime/v1/domain/FileRuntime.java | 0
.../sdk/runtime/v1/domain/HelloRuntime.java | 0
.../sdk/runtime/v1/domain/HelloRxRuntime.java | 23 +-
.../runtime/v1/domain/InvocationRuntime.java | 19 +-
.../sdk/runtime/v1/domain/LockRuntime.java | 0
.../sdk/runtime/v1/domain/PubSubRuntime.java | 2 +-
.../runtime/v1/domain/SequencerRuntime.java | 0
.../sdk/runtime/v1/domain/StateRuntime.java | 10 +-
.../configuration/ConfigurationItem.java | 22 +-
.../ConfigurationRequestItem.java | 24 +-
.../ConfigurationRequestItemBuilder.java | 26 +-
.../SaveConfigurationRequest.java | 2 +-
.../configuration/SubConfigurationResp.java | 15 +-
.../v1/domain/file/DelFileRequest.java | 14 +-
.../v1/domain/file/DelFileResponse.java | 0
.../sdk/runtime/v1/domain/file/FileInfo.java | 19 +-
.../v1/domain/file/GetFileRequest.java | 15 +-
.../v1/domain/file/GetFileResponse.java | 7 +
.../v1/domain/file/GetMetaRequest.java | 15 +-
.../v1/domain/file/GetMeteResponse.java | 7 +-
.../v1/domain/file/ListFileRequest.java | 21 +-
.../v1/domain/file/ListFileResponse.java | 17 +-
.../v1/domain/file/PutFileRequest.java | 18 +-
.../v1/domain/file/PutFileResponse.java | 0
.../v1/domain}/invocation/HttpExtension.java | 43 +--
.../invocation/InvokeMethodRequest.java | 24 +-
.../v1/domain/invocation/InvokeResponse.java | 11 +-
.../v1/domain}/invocation/Metadata.java | 2 +-
.../v1/domain/lock/TryLockRequest.java | 65 +++++
.../v1/domain/lock/TryLockResponse.java | 16 +
.../runtime/v1/domain/lock/UnlockRequest.java | 34 +++
.../v1/domain/lock/UnlockResponse.java | 53 ++++
.../sdk/runtime/v1/domain/package-info.java | 5 +
.../v1/domain/pubsub/PublishEventRequest.java | 21 +-
.../v1/domain/pubsub/TopicEventRequest.java | 33 ++-
.../v1/domain/pubsub/TopicEventResponse.java | 8 +
.../pubsub/TopicEventResponseStatus.java | 1 +
.../v1/domain/pubsub/TopicSubscription.java | 14 +-
.../v1/domain/state/DeleteStateRequest.java | 19 +-
.../state/ExecuteStateTransactionRequest.java | 16 +-
.../v1/domain/state/GetBulkStateRequest.java | 18 +-
.../v1/domain/state/GetStateRequest.java | 18 +-
.../v1/domain/state/SaveStateRequest.java | 10 +-
.../sdk/runtime/v1/domain/state/State.java | 22 +-
.../runtime/v1/domain/state/StateOptions.java | 12 +
.../state/TransactionalStateOperation.java | 10 +-
.../state/TransactionalStateRequest.java | 10 +-
sdk-reactor/pom.xml | 25 +-
.../client/reactor/LayottoReactorClient.java | 30 +-
.../reactor/LayottoReactorClientGrpc.java | 8 +-
.../v1/domain/core/ConfigurationRuntimes.java | 8 +-
.../v1/domain/core/InvocationRuntimes.java | 4 +-
.../core/pubsub/PublishEventRequest.java | 78 -----
.../domain/core/state/DeleteStateRequest.java | 74 -----
.../state/ExecuteStateTransactionRequest.java | 63 ----
.../core/state/GetBulkStateRequest.java | 70 -----
.../v1/domain/core/state/GetStateRequest.java | 63 ----
.../domain/core/state/SaveStateRequest.java | 51 ----
.../reactor/v1/domain/core/state/State.java | 276 ------------------
.../v1/domain/core/state/StateOptions.java | 101 -------
.../state/TransactionalStateOperation.java | 80 -----
.../core/state/TransactionalStateRequest.java | 51 ----
sdk/pom.xml | 5 +
.../v1/domain/lock/TryLockRequest.java | 22 --
spec/pom.xml | 178 +++++------
.../proto/runtime/v1/AppCallbackGrpc.java | 14 +
.../proto/runtime/v1/AppCallbackProto.java | 14 +
.../spec/proto/runtime/v1/RuntimeGrpc.java | 14 +
.../spec/proto/runtime/v1/RuntimeProto.java | 14 +
73 files changed, 833 insertions(+), 1201 deletions(-)
create mode 100644 sdk-domain/pom.xml
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/HelloRuntime.java (100%)
rename sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java (63%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/InvocationRuntime.java (60%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/LockRuntime.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/SequencerRuntime.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java (96%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/configuration/ConfigurationItem.java (80%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/configuration/ConfigurationRequestItem.java (78%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/configuration/ConfigurationRequestItemBuilder.java (74%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/configuration/SaveConfigurationRequest.java (97%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/configuration/SubConfigurationResp.java (80%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileRequest.java (81%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/DelFileResponse.java (100%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/FileInfo.java (82%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileRequest.java (81%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/GetFileResponse.java (87%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/GetMetaRequest.java (81%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/GetMeteResponse.java (93%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileRequest.java (78%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/ListFileResponse.java (78%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileRequest.java (80%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/file/PutFileResponse.java (100%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/invocation/HttpExtension.java (69%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/invocation/InvokeMethodRequest.java (74%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeResponse.java (87%)
rename {sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain}/invocation/Metadata.java (94%)
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java (69%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java (50%)
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockResponse.java
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/pubsub/PublishEventRequest.java (86%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventRequest.java (86%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponse.java (88%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicEventResponseStatus.java (99%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/pubsub/TopicSubscription.java (87%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/DeleteStateRequest.java (83%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/ExecuteStateTransactionRequest.java (83%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/GetBulkStateRequest.java (84%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/GetStateRequest.java (82%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/SaveStateRequest.java (85%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/State.java (91%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/StateOptions.java (90%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateOperation.java (85%)
rename {sdk => sdk-domain}/src/main/java/spec/sdk/runtime/v1/domain/state/TransactionalStateRequest.java (88%)
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/pubsub/PublishEventRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/DeleteStateRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/ExecuteStateTransactionRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetBulkStateRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetStateRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/SaveStateRequest.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/State.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/StateOptions.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateOperation.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateRequest.java
delete mode 100644 sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
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/pom.xml b/pom.xml
index d57ab0a..86cf20b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,10 +13,11 @@
https://github.com/mosn/layotto
- sdk
examples
+ sdk
sdk-reactor
spec
+ sdk-domain
@@ -24,6 +25,7 @@
1.34.1
1.7.30
1.2.69
+ 3.4.12
4.13.1
3.11.2
@@ -36,11 +38,22 @@
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-domain
+ ${project.version}
+
+
com.alibaba
@@ -76,6 +89,7 @@
grpc-stub
${grpc.version}
+
org.mockito
@@ -203,6 +217,7 @@
http://github.com/mosn/layotto
scm:git:https://github.com/mosn/layotto.git
+
release
@@ -260,4 +275,5 @@
+
diff --git a/sdk-domain/pom.xml b/sdk-domain/pom.xml
new file mode 100644
index 0000000..b0a8162
--- /dev/null
+++ b/sdk-domain/pom.xml
@@ -0,0 +1,31 @@
+
+
+ 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.projectreactor
+ reactor-core
+ ${reactor-core.version}
+ compile
+ true
+
+
+
+
\ No newline at end of file
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
similarity index 100%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRuntime.java
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 100%
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
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/lock/UnlockResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java
similarity index 63%
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/HelloRxRuntime.java
index a12f819..0204ad1 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/HelloRxRuntime.java
@@ -12,20 +12,19 @@
* 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;
-enum UnlockResponseStatus {
- SUCCESS(0),
- LOCK_UNEXIST(1),
- LOCK_BELONG_TO_OTHERS(2),
- INTERNAL_ERROR(3);
- private final int value;
+import reactor.core.publisher.Mono;
- UnlockResponseStatus(int value) {
- this.value = value;
+public interface HelloRxRuntime extends HelloRuntime {
+
+ @Override
+ default String sayHello(String name) {
+ return sayHelloAsync(name).block();
}
-}
-public class UnlockResponse {
- public UnlockResponseStatus status;
+ Mono sayHelloAsync(String name);
+
+ @Override
+ String sayHello(String name, int timeoutMillisecond);
}
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 100%
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..37a3161 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
@@ -17,6 +17,7 @@
import java.util.Map;
public interface PubSubRuntime {
+
/**
* Publish an event.
*
@@ -48,5 +49,4 @@ public interface PubSubRuntime {
void publishEvent(String pubsubName, String topicName, byte[] data, Map metadata);
void publishEvent(String pubsubName, String topicName, byte[] data, String contentType, Map metadata);
-
}
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 96%
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..859f2dc 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);
@@ -135,8 +135,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 +190,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 80%
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..0ba4870 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,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.Map;
@@ -21,20 +21,20 @@ public class ConfigurationItem {
/**
* Required. The key of configuration item
*/
- private String key;
+ private String key;
/**
* 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 T content;
/**
* The group of configuration item.
*/
- private String group;
+ private String group;
/**
* The label of configuration item.
*/
- private String label;
+ private String label;
/**
* The tag list of configuration item.
*/
@@ -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 78%
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..08cbd52 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;
@@ -25,24 +25,24 @@ public class ConfigurationRequestItem {
/**
* 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 group of keys.
*/
- private String group;
+ private String group;
/**
* The label for keys.
*/
- private String label;
+ private String label;
/**
* The keys to get.
*/
- private List keys;
+ private List keys;
/**
* The metadata which will be sent to configuration store components.
*/
@@ -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 74%
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..df9ff2c 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;
@@ -22,15 +22,15 @@
*/
public class ConfigurationRequestItemBuilder {
- private final String storeName;
+ private final String storeName;
- private final String appId;
+ private final String appId;
- private String group;
+ private String group;
- private String label;
+ private String label;
- private List keys;
+ private List keys;
private Map metadata;
@@ -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 97%
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..95cf0da 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;
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 80%
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..8744d5c 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,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;
@@ -21,12 +21,12 @@ 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
@@ -56,4 +56,13 @@ public List> getItems() {
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 81%
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..669a548 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
@@ -19,8 +19,8 @@
public class DelFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -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 82%
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..466b112 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,9 +18,10 @@
import java.util.Map;
public class FileInfo {
- private String fileName;
- private long size;
- private String lastModified;
+
+ private String fileName;
+ private long size;
+ private String lastModified;
private Map metaData;
public FileInfo(String fileName, long size, String lastModified, Map metaData) {
@@ -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 81%
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..d0bc541 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
@@ -19,8 +19,8 @@
public class GetFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -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..546b67d 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 81%
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..69cc4e0 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
@@ -19,8 +19,8 @@
public class GetMetaRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -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 93%
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..c79d1f0 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,8 +18,9 @@
import java.util.Map;
public class GetMeteResponse {
- private long size;
- private String lastModified;
+
+ private long size;
+ private String lastModified;
private Map meta;
public long getSize() {
@@ -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 78%
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..ff8d6c1 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
@@ -19,12 +19,12 @@
public class ListFileRequest {
- private String storeName;
- private String name;
+ private String storeName;
+ private String name;
private Map metaData;
- private int pageSize;
- private String marker;
+ private int pageSize;
+ private String marker;
public String getStoreName() {
return storeName;
@@ -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 78%
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..7b0eb79 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,10 +14,12 @@
*/
package spec.sdk.runtime.v1.domain.file;
+import java.util.Arrays;
+
public class ListFileResponse {
- private boolean isTruncated;
- private String marker;
+ private boolean isTruncated;
+ private String marker;
private FileInfo[] files;
@@ -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 80%
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..20edab5 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
@@ -20,12 +20,12 @@
public class PutFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
- private InputStream in;
+ private InputStream in;
public String getStoreName() {
return storeName;
@@ -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 69%
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..f7be833 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,12 @@
* 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 okhttp3.HttpUrl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
/**
* HTTP Extension class.
@@ -31,27 +29,27 @@ public final class HttpExtension {
/**
* Convenience HttpExtension object for {@link HttpMethods#NONE} with empty queryString.
*/
- public static final HttpExtension NONE = new HttpExtension(HttpMethods.NONE);
+ public static final HttpExtension NONE = new HttpExtension(HttpMethods.NONE);
/**
* Convenience HttpExtension object for the {@link HttpMethods#GET} Verb with empty queryString.
*/
- public static final HttpExtension GET = new HttpExtension(HttpMethods.GET);
+ public static final HttpExtension GET = new HttpExtension(HttpMethods.GET);
/**
* Convenience HttpExtension object for the {@link HttpMethods#PUT} Verb with empty queryString.
*/
- public static final HttpExtension PUT = new HttpExtension(HttpMethods.PUT);
+ public static final HttpExtension PUT = new HttpExtension(HttpMethods.PUT);
/**
* Convenience HttpExtension object for the {@link HttpMethods#POST} Verb with empty queryString.
*/
- public static final HttpExtension POST = new HttpExtension(HttpMethods.POST);
+ public static final HttpExtension POST = new HttpExtension(HttpMethods.POST);
/**
* Convenience HttpExtension object for the {@link HttpMethods#DELETE} Verb with empty queryString.
*/
- public static final HttpExtension DELETE = new HttpExtension(HttpMethods.DELETE);
+ public static final HttpExtension DELETE = new HttpExtension(HttpMethods.DELETE);
/**
* Convenience HttpExtension object for the {@link HttpMethods#HEAD} Verb with empty queryString.
*/
- public static final HttpExtension HEAD = new HttpExtension(HttpMethods.HEAD);
+ public static final HttpExtension HEAD = new HttpExtension(HttpMethods.HEAD);
/**
* Convenience HttpExtension object for the {@link HttpMethods#CONNECT} Verb with empty queryString.
*/
@@ -63,12 +61,12 @@ public final class HttpExtension {
/**
* Convenience HttpExtension object for the {@link HttpMethods#TRACE} Verb with empty queryString.
*/
- public static final HttpExtension TRACE = new HttpExtension(HttpMethods.TRACE);
+ public static final HttpExtension TRACE = new HttpExtension(HttpMethods.TRACE);
/**
* HTTP verb.
*/
- private HttpMethods method;
+ private HttpMethods method;
/**
* HTTP query params.
@@ -78,7 +76,7 @@ public final class HttpExtension {
/**
* HTTP headers.
*/
- private Map headers;
+ private Map headers;
/**
* Construct a HttpExtension object.
@@ -124,27 +122,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 74%
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..78fde71 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;
@@ -21,15 +21,15 @@
*/
public class InvokeMethodRequest {
- private final String appId;
+ private final String appId;
- private final String method;
+ private final String method;
- private Object body;
+ private Object body;
- private HttpExtension httpExtension;
+ private HttpExtension httpExtension;
- private String contentType;
+ private String contentType;
private Map metadata;
@@ -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 87%
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..977c9ec 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,8 +15,9 @@
package spec.sdk.runtime.v1.domain.invocation;
public class InvokeResponse {
+
private String contentType;
- private T data;
+ private T data;
/**
* Getter method for property contentType.
@@ -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..4932c92
--- /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/TryLockResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
similarity index 69%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
index 30a4dbb..2719bb3 100644
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
@@ -15,5 +15,21 @@
package spec.sdk.runtime.v1.domain.lock;
public class TryLockResponse {
+
public boolean success;
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ @Override
+ public String toString() {
+ return "TryLockResponse{" +
+ "success=" + success +
+ '}';
+ }
}
\ No newline at end of file
diff --git a/sdk/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
similarity index 50%
rename from sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/UnlockRequest.java
index 49458e6..9447943 100644
--- a/sdk/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
@@ -15,7 +15,41 @@
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..850f698
--- /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-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
new file mode 100644
index 0000000..1f9e6b9
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * 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 86%
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..36acee7 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,18 +14,20 @@
*/
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;
+ private String pubsubName;
// The pubsub topic
- private String topic;
+ private String topic;
// The data which will be published to topic.
- private byte[] data;
+ private byte[] data;
// The content type for the data (optional).
- private String contentType;
+ private String contentType;
// The metadata passing to pub components
//
@@ -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 86%
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..64c2db7 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,38 +14,40 @@
*/
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.
- private String id;
+ private String id;
// source identifies the context in which an event happened.
// Often this will include information such as the type of the
// event source, the organization publishing the event or the process
// that produced the event. The exact syntax and semantics behind
// the data encoded in the URI is defined by the event producer.
- private String source;
+ private String source;
// The type of event related to the originating occurrence.
- private String type;
+ private String type;
// The version of the CloudEvents specification.
- private String specVersion;
+ private String specVersion;
// The content type of data value.
- private String contentType;
+ private String contentType;
// The content of the event.
- private byte[] data;
+ private byte[] data;
// The pubsub topic which publisher sent to.
- private String topic;
+ private String topic;
// The name of the pubsub the publisher sent to.
- private String pubsubName;
+ private String pubsubName;
// add a map to pass some extra properties.
private Map metadata;
@@ -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..0e39444 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 87%
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..dce2ffa 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,11 +17,12 @@
import java.util.Map;
public class TopicSubscription {
+
// Required. The name of the pubsub containing the topic below to subscribe to.
- private String pubsubName;
+ private String pubsubName;
// Required. The name of topic which will be subscribed
- private String topic;
+ private String topic;
// The optional properties used for this topic's subscription e.g. session id
private Map metadata;
@@ -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 85%
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..7d5916f 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
@@ -21,7 +21,7 @@
*/
public class SaveStateRequest {
- private final String storeName;
+ private final String storeName;
private List> states;
@@ -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 91%
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..20084eb 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
@@ -26,17 +26,17 @@ public class State {
/**
* The key of the state.
*/
- private final String key;
+ private final String key;
/**
* The value of the state.
*/
- private final T value;
+ private final T value;
/**
* The ETag to be used Keep in mind that for some state stores (like redis) only numbers are supported.
*/
- private final String etag;
+ private final String etag;
/**
* The metadata which will be passed to state store component.
@@ -46,12 +46,12 @@ public class State {
/**
* The error in case the key could not be retrieved.
*/
- private final String error;
+ private final String error;
/**
* The options used for saving the state.
*/
- private final StateOptions options;
+ private final StateOptions options;
/**
* Create an immutable state reference to be retrieved or deleted. This Constructor CAN be used anytime you need to retrieve or delete a
@@ -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 90%
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..29f1c19 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 85%
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..c0c624f 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
@@ -24,7 +24,7 @@ public class TransactionalStateOperation {
/**
* State values to be operated on.
*/
- private final State request;
+ private final State request;
/**
* Construct an immutable transactional state operation object.
@@ -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 88%
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..3d08adb 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
@@ -28,7 +28,7 @@ public class TransactionalStateRequest {
/**
* Metadata used for transactional operations.
*/
- private final Map metadata;
+ private final Map metadata;
/**
* Constructor to create immutable transactional state request object.
@@ -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-reactor/pom.xml b/sdk-reactor/pom.xml
index ae43a86..5ce22fd 100644
--- a/sdk-reactor/pom.xml
+++ b/sdk-reactor/pom.xml
@@ -11,43 +11,58 @@
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
+
+ io.mosn.layotto
+ runtime-sdk-domain
+
+
org.slf4j
slf4j-api
+
io.projectreactor
reactor-core
- 3.3.11.RELEASE
+ ${reactor-core.version}
+
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/LayottoReactorClient.java b/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClient.java
index dc8ea27..f440c8d 100644
--- 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
@@ -17,21 +17,21 @@
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.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 spec.sdk.runtime.v1.domain.invocation.HttpExtension;
+import spec.sdk.runtime.v1.domain.invocation.InvokeMethodRequest;
+import spec.sdk.runtime.v1.domain.pubsub.PublishEventRequest;
+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 spec.sdk.reactor.v1.utils.TypeRef;
import java.util.List;
diff --git a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClientGrpc.java b/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClientGrpc.java
index 996502c..cfb4f84 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClientGrpc.java
+++ b/sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClientGrpc.java
@@ -38,10 +38,10 @@
import reactor.util.context.Context;
import spec.proto.runtime.v1.RuntimeGrpc;
import spec.proto.runtime.v1.RuntimeProto;
-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.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 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;
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java
index 2a726fb..7c63716 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java
+++ b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java
@@ -16,10 +16,10 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
-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.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 spec.sdk.reactor.v1.utils.TypeRef;
import java.util.List;
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/InvocationRuntimes.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/InvocationRuntimes.java
index 7d9f20b..34d5d1c 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/InvocationRuntimes.java
+++ b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/InvocationRuntimes.java
@@ -15,9 +15,9 @@
package spec.sdk.reactor.v1.domain.core;
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.utils.TypeRef;
+import spec.sdk.runtime.v1.domain.invocation.HttpExtension;
+import spec.sdk.runtime.v1.domain.invocation.InvokeMethodRequest;
import java.util.Map;
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/pubsub/PublishEventRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/pubsub/PublishEventRequest.java
deleted file mode 100644
index 23ed0ab..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/pubsub/PublishEventRequest.java
+++ /dev/null
@@ -1,78 +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 spec.sdk.reactor.v1.domain.core.pubsub;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A request to publish an event.
- */
-public class PublishEventRequest {
-
- private final String pubsubName;
-
- private final String topic;
-
- private final Object data;
-
- private String contentType;
-
- private Map metadata = new HashMap<>();
-
- /**
- * Constructor for PublishEventRequest.
- *
- * @param pubsubName name of the pubsub
- * @param topic name of the topic in the pubsub
- * @param data data to published
- */
- public PublishEventRequest(String pubsubName, String topic, Object data) {
- this.pubsubName = pubsubName;
- this.topic = topic;
- this.data = data;
- }
-
- public String getPubsubName() {
- return pubsubName;
- }
-
- public String getTopic() {
- return topic;
- }
-
- public Object getData() {
- return data;
- }
-
- public String getContentType() {
- return this.contentType;
- }
-
- public PublishEventRequest setContentType(String contentType) {
- this.contentType = contentType;
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public PublishEventRequest setMetadata(Map metadata) {
- this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
- return this;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/DeleteStateRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/DeleteStateRequest.java
deleted file mode 100644
index 2e36361..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/DeleteStateRequest.java
+++ /dev/null
@@ -1,74 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * A request to delete a state by key.
- */
-public class DeleteStateRequest {
-
- private final String stateStoreName;
-
- private final String key;
-
- private Map metadata;
-
- private String etag;
-
- private StateOptions stateOptions;
-
- public DeleteStateRequest(String storeName, String key) {
- this.stateStoreName = storeName;
- this.key = key;
- }
-
- public String getStateStoreName() {
- return stateStoreName;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getEtag() {
- return etag;
- }
-
- public DeleteStateRequest setEtag(String etag) {
- this.etag = etag;
- return this;
- }
-
- public StateOptions getStateOptions() {
- return stateOptions;
- }
-
- public DeleteStateRequest setStateOptions(StateOptions stateOptions) {
- this.stateOptions = stateOptions;
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public DeleteStateRequest setMetadata(Map metadata) {
- this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
- return this;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/ExecuteStateTransactionRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/ExecuteStateTransactionRequest.java
deleted file mode 100644
index 8bed077..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/ExecuteStateTransactionRequest.java
+++ /dev/null
@@ -1,63 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-public class ExecuteStateTransactionRequest {
-
- /**
- * Name of the state store.
- */
- private final String stateStoreName;
-
- /**
- * Transactional operations list.
- */
- private List> operations;
-
- /**
- * Metadata used for transactional operations.
- */
- private Map metadata;
-
- public ExecuteStateTransactionRequest(String stateStoreName) {
- this.stateStoreName = stateStoreName;
- }
-
- public String getStateStoreName() {
- return stateStoreName;
- }
-
- public ExecuteStateTransactionRequest setOperations(List> operations) {
- this.operations = operations == null ? null : Collections.unmodifiableList(operations);
- return this;
- }
-
- public List> getOperations() {
- return operations;
- }
-
- public ExecuteStateTransactionRequest setMetadata(Map metadata) {
- this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetBulkStateRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetBulkStateRequest.java
deleted file mode 100644
index 11c5f5a..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetBulkStateRequest.java
+++ /dev/null
@@ -1,70 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A request to get bulk state by keys.
- */
-public class GetBulkStateRequest {
-
- private final String storeName;
-
- private final List keys;
-
- private Map metadata;
-
- private int parallelism = 1;
-
- public GetBulkStateRequest(String storeName, List keys) {
- this.storeName = storeName;
- this.keys = keys == null ? null : Collections.unmodifiableList(keys);
- }
-
- public GetBulkStateRequest(String storeName, String... keys) {
- this.storeName = storeName;
- this.keys = keys == null ? null : Collections.unmodifiableList(Arrays.asList(keys));
- }
-
- public String getStoreName() {
- return storeName;
- }
-
- public List getKeys() {
- return keys;
- }
-
- public int getParallelism() {
- return parallelism;
- }
-
- public GetBulkStateRequest setParallelism(int parallelism) {
- this.parallelism = parallelism;
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public GetBulkStateRequest setMetadata(Map metadata) {
- this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
- return this;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetStateRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetStateRequest.java
deleted file mode 100644
index 141ef0e..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/GetStateRequest.java
+++ /dev/null
@@ -1,63 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * A request to get a state by key.
- */
-public class GetStateRequest {
-
- private final String storeName;
-
- private final String key;
-
- private Map metadata;
-
- private StateOptions stateOptions;
-
- public GetStateRequest(String storeName, String key) {
- this.storeName = storeName;
- this.key = key;
- }
-
- public String getStoreName() {
- return storeName;
- }
-
- public String getKey() {
- return key;
- }
-
- public StateOptions getStateOptions() {
- return stateOptions;
- }
-
- public GetStateRequest setStateOptions(StateOptions stateOptions) {
- this.stateOptions = stateOptions;
- return this;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public GetStateRequest setMetadata(Map metadata) {
- this.metadata = metadata == null ? null : Collections.unmodifiableMap(metadata);
- return this;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/SaveStateRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/SaveStateRequest.java
deleted file mode 100644
index da6aca2..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/SaveStateRequest.java
+++ /dev/null
@@ -1,51 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A request to save states to state store.
- */
-public class SaveStateRequest {
-
- private final String storeName;
-
- private List> states;
-
- public SaveStateRequest(String storeName) {
- this.storeName = storeName;
- }
-
- public String getStoreName() {
- return storeName;
- }
-
- public List> getStates() {
- return states;
- }
-
- public SaveStateRequest setStates(List> states) {
- this.states = states == null ? null : Collections.unmodifiableList(states);
- return this;
- }
-
- public SaveStateRequest setStates(State>... states) {
- this.states = Collections.unmodifiableList(Arrays.asList(states));
- return this;
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/State.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/State.java
deleted file mode 100644
index c25f733..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/State.java
+++ /dev/null
@@ -1,276 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Map;
-
-/**
- * This class reprent what a State is.
- *
- * @param The type of the value of the sate
- */
-public class State {
-
- /**
- * The value of the state.
- */
- private final T value;
-
- /**
- * The key of the state.
- */
- private final String key;
-
- /**
- * The ETag to be used
- * Keep in mind that for some state stores (like redis) only numbers are supported.
- */
- private final String etag;
-
- /**
- * The metadata which will be passed to state store component.
- */
- private final Map metadata;
-
- /**
- * The error in case the key could not be retrieved.
- */
- private final String error;
-
- /**
- * The options used for saving the state.
- */
- private final StateOptions options;
-
- /**
- * Create an immutable state reference to be retrieved or deleted.
- * This Constructor CAN be used anytime you need to retrieve or delete a state.
- *
- * @param key - The key of the state
- */
- public State(String key) {
- this.key = key;
- this.value = null;
- this.etag = null;
- this.metadata = null;
- this.options = null;
- this.error = null;
- }
-
- /**
- * Create an immutable state reference to be retrieved or deleted.
- * This Constructor CAN be used anytime you need to retrieve or delete a state.
- *
- * @param key - The key of the state
- * @param etag - The etag of the state - Keep in mind that for some state stores (like redis) only numbers
- * are supported.
- * @param options - REQUIRED when saving a state.
- */
- public State(String key, String etag, StateOptions options) {
- this.value = null;
- this.key = key;
- this.etag = etag;
- this.metadata = null;
- this.options = options;
- this.error = null;
- }
-
- /**
- * Create an immutable state.
- * This Constructor CAN be used anytime you want the state to be saved.
- *
- * @param key - The key of the state.
- * @param value - The value of the state.
- * @param etag - The etag of the state - for some state stores (like redis) only numbers are supported.
- * @param options - REQUIRED when saving a state.
- */
- public State(String key, T value, String etag, StateOptions options) {
- this.value = value;
- this.key = key;
- this.etag = etag;
- this.metadata = null;
- this.options = options;
- this.error = null;
- }
-
- /**
- * Create an immutable state.
- * This Constructor CAN be used anytime you want the state to be saved.
- *
- * @param key - The key of the state.
- * @param value - The value of the state.
- * @param etag - The etag of the state - for some state stores (like redis) only numbers are supported.
- * @param metadata - The metadata of the state.
- * @param options - REQUIRED when saving a state.
- */
- public State(String key, T value, String etag, Map metadata, StateOptions options) {
- this.value = value;
- this.key = key;
- this.etag = etag;
- this.metadata = metadata;
- this.options = options;
- this.error = null;
- }
-
- /**
- * Create an immutable state.
- * This Constructor CAN be used anytime you want the state to be saved.
- *
- * @param key - The key of the state.
- * @param value - The value of the state.
- * @param etag - The etag of the state - some state stores (like redis) only numbers are supported.
- */
- public State(String key, T value, String etag) {
- this.value = value;
- this.key = key;
- this.etag = etag;
- this.metadata = null;
- this.options = null;
- this.error = null;
- }
-
- /**
- * Create an immutable state.
- * This Constructor MUST be used anytime the key could not be retrieved and contains an error.
- *
- * @param key - The key of the state.
- * @param error - Error when fetching the state.
- */
- public State(String key, String error) {
- this.value = null;
- this.key = key;
- this.etag = null;
- this.metadata = null;
- this.options = null;
- this.error = error;
- }
-
- /**
- * Retrieves the Value of the state.
- *
- * @return The value of the state
- */
- public T getValue() {
- return value;
- }
-
- /**
- * Retrieves the Key of the state.
- *
- * @return The key of the state
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Retrieve the ETag of this state.
- *
- * @return The etag of the state
- */
- public String getEtag() {
- return etag;
- }
-
- /**
- * Retrieve the metadata of this state.
- *
- * @return the metadata of this state
- */
- public Map getMetadata() {
- return metadata;
- }
-
- /**
- * Retrieve the error for this state.
- *
- * @return The error for this state.
- */
-
- public String getError() {
- return error;
- }
-
- /**
- * Retrieve the Options used for saving the state.
- *
- * @return The options to save the state
- */
- public StateOptions getOptions() {
- return options;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof State)) {
- return false;
- }
-
- State> that = (State>) o;
-
- if (getValue() != null ? !getValue().equals(that.getValue()) : that.getValue() != null) {
- return false;
- }
-
- if (getKey() != null ? !getKey().equals(that.getKey()) : that.getKey() != null) {
- return false;
- }
-
- if (getEtag() != null ? !getEtag().equals(that.getEtag()) : that.getEtag() != null) {
- return false;
- }
-
- if (getError() != null ? !getError().equals(that.getError()) : that.getError() != null) {
- return false;
- }
-
- if (getMetadata() != null ? !getMetadata().equals(that.getMetadata()) : that.getMetadata() != null) {
- return false;
- }
-
- if (getOptions() != null ? !getOptions().equals(that.getOptions()) : that.getOptions() != null) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = getValue() != null ? getValue().hashCode() : 0;
- result = 31 * result + (getKey() != null ? getKey().hashCode() : 0);
- result = 31 * result + (getEtag() != null ? getEtag().hashCode() : 0);
- result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0);
- result = 31 * result + (getError() != null ? getError().hashCode() : 0);
- result = 31 * result + (getOptions() != null ? options.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "StateKeyValue{"
- + "key='" + key + "'"
- + ", value=" + value
- + ", etag='" + etag + "'"
- + ", metadata={'" + (metadata != null ? metadata.toString() : null) + "'}"
- + ", error='" + error + "'"
- + ", options={'" + (options != null ? options.toString() : null) + "'}"
- + "}";
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/StateOptions.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/StateOptions.java
deleted file mode 100644
index 2874b42..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/StateOptions.java
+++ /dev/null
@@ -1,101 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-public class StateOptions {
-
- private final Consistency consistency;
- private final Concurrency concurrency;
-
- /**
- * Represents options for a CloudRuntimes state API call.
- *
- * @param consistency The consistency mode.
- * @param concurrency The concurrency mode.
- */
- public StateOptions(Consistency consistency, Concurrency concurrency) {
- this.consistency = consistency;
- this.concurrency = concurrency;
- }
-
- public Concurrency getConcurrency() {
- return concurrency;
- }
-
- public Consistency getConsistency() {
- return consistency;
- }
-
- /**
- * Returns state options as a Map of option name to value.
- *
- * @return A map of state options.
- */
- public Map getStateOptionsAsMap() {
- Map mapOptions = new HashMap<>();
- if (this.getConsistency() != null) {
- mapOptions.put("consistency", this.getConsistency().getValue());
- }
- if (this.getConcurrency() != null) {
- mapOptions.put("concurrency", this.getConcurrency().getValue());
- }
- return Collections.unmodifiableMap(Optional.ofNullable(mapOptions).orElse(Collections.EMPTY_MAP));
- }
-
- public enum Consistency {
-
- EVENTUAL("eventual"),
- STRONG("strong");
-
- private final String value;
-
- Consistency(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return this.value;
- }
-
- public static Consistency fromValue(String value) {
- return Consistency.valueOf(value);
- }
- }
-
- public enum Concurrency {
-
- FIRST_WRITE("first-write"),
- LAST_WRITE("last-write");
-
- private final String value;
-
- Concurrency(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return this.value;
- }
-
- public static Concurrency fromValue(String value) {
- return Concurrency.valueOf(value);
- }
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateOperation.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateOperation.java
deleted file mode 100644
index 81f8d17..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateOperation.java
+++ /dev/null
@@ -1,80 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Objects;
-
-public class TransactionalStateOperation {
-
- /**
- * The type of operation to be executed.
- */
- private final OperationType operation;
-
- /**
- * State values to be operated on.
- */
- private final State request;
-
- /**
- * Construct an immutable transactional state operation object.
- *
- * @param operationType The type of operation done.
- * @param state The required state.
- */
- public TransactionalStateOperation(OperationType operationType, State state) {
- this.operation = operationType;
- this.request = state;
- }
-
- public OperationType getOperation() {
- return operation;
- }
-
- public State getRequest() {
- return request;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- TransactionalStateOperation> that = (TransactionalStateOperation>) o;
- return operation.equals(that.operation)
- && request.equals(that.request);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(operation, request);
- }
-
- @Override
- public String toString() {
- return "TransactionalStateOperation{"
- + "operationType='" + operation + '\''
- + ", state=" + request
- + '}';
- }
-
- public enum OperationType {
- UPSERT,
- DELETE
- }
-}
diff --git a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateRequest.java b/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateRequest.java
deleted file mode 100644
index 620b306..0000000
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/state/TransactionalStateRequest.java
+++ /dev/null
@@ -1,51 +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 spec.sdk.reactor.v1.domain.core.state;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-public class TransactionalStateRequest {
-
- /**
- * Transactional operations list.
- */
- private final List> operations;
-
- /**
- * Metadata used for transactional operations.
- */
- private final Map metadata;
-
- /**
- * Constructor to create immutable transactional state request object.
- *
- * @param operations List of operations to be performed.
- * @param metadata Metadata used for transactional operations.
- */
- public TransactionalStateRequest(List> operations, Map metadata) {
- this.operations = operations;
- this.metadata = metadata;
- }
-
- public List> getOperations() {
- return Collections.unmodifiableList(operations);
- }
-
- public Map getMetadata() {
- return metadata;
- }
-}
diff --git a/sdk/pom.xml b/sdk/pom.xml
index 792b2e7..8434ac8 100644
--- a/sdk/pom.xml
+++ b/sdk/pom.xml
@@ -20,6 +20,11 @@
io.mosn.layotto
runtime-spec-pb
+
+ io.mosn.layotto
+ runtime-sdk-domain
+
+
com.alibaba
diff --git a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java b/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
deleted file mode 100644
index 9dcfbc5..0000000
--- a/sdk/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockRequest.java
+++ /dev/null
@@ -1,22 +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 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
diff --git a/spec/pom.xml b/spec/pom.xml
index 5eed022..6094343 100644
--- a/spec/pom.xml
+++ b/spec/pom.xml
@@ -1,101 +1,101 @@
- 4.0.0
+ 4.0.0
-
- io.mosn.layotto
- runtime-sdk-parent
- 1.1.0-SNAPSHOT
-
+
+ io.mosn.layotto
+ runtime-sdk-parent
+ 1.1.0-SNAPSHOT
+
- runtime-spec-pb
- runtime-spec-pb
- jar
+ runtime-spec-pb
+ runtime-spec-pb
+ jar
-
-
- io.grpc
- grpc-all
-
-
+
+
+ io.grpc
+ grpc-all
+
+
-
- src/main/java
-
-
- src/main/resources
- true
-
- **/**
-
-
-
- proto
- true
-
- **/*.proto
-
-
-
+
+ src/main/java
+
+
+ src/main/resources
+ true
+
+ **/**
+
+
+
+ proto
+ true
+
+ **/*.proto
+
+
+
- src/test/java
-
-
- src/test/resources
- true
-
- **/**
-
-
-
+ src/test/java
+
+
+ src/test/resources
+ true
+
+ **/**
+
+
+
-
-
- kr.motd.maven
- os-maven-plugin
- 1.4.1.Final
-
-
+
+
+ kr.motd.maven
+ os-maven-plugin
+ 1.4.1.Final
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.0.1
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.1
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spec/src/main/java/spec/proto/runtime/v1/AppCallbackGrpc.java b/spec/src/main/java/spec/proto/runtime/v1/AppCallbackGrpc.java
index 33bc7b9..a5bbe30 100644
--- a/spec/src/main/java/spec/proto/runtime/v1/AppCallbackGrpc.java
+++ b/spec/src/main/java/spec/proto/runtime/v1/AppCallbackGrpc.java
@@ -1,3 +1,17 @@
+/*
+ * 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.proto.runtime.v1;
import static io.grpc.MethodDescriptor.generateFullMethodName;
diff --git a/spec/src/main/java/spec/proto/runtime/v1/AppCallbackProto.java b/spec/src/main/java/spec/proto/runtime/v1/AppCallbackProto.java
index 3477433..91a5fd5 100644
--- a/spec/src/main/java/spec/proto/runtime/v1/AppCallbackProto.java
+++ b/spec/src/main/java/spec/proto/runtime/v1/AppCallbackProto.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/runtime/v1/appcallback.proto
diff --git a/spec/src/main/java/spec/proto/runtime/v1/RuntimeGrpc.java b/spec/src/main/java/spec/proto/runtime/v1/RuntimeGrpc.java
index 9e194c5..aff843d 100644
--- a/spec/src/main/java/spec/proto/runtime/v1/RuntimeGrpc.java
+++ b/spec/src/main/java/spec/proto/runtime/v1/RuntimeGrpc.java
@@ -1,3 +1,17 @@
+/*
+ * 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.proto.runtime.v1;
import static io.grpc.MethodDescriptor.generateFullMethodName;
diff --git a/spec/src/main/java/spec/proto/runtime/v1/RuntimeProto.java b/spec/src/main/java/spec/proto/runtime/v1/RuntimeProto.java
index 92b8cd8..415158a 100644
--- a/spec/src/main/java/spec/proto/runtime/v1/RuntimeProto.java
+++ b/spec/src/main/java/spec/proto/runtime/v1/RuntimeProto.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/runtime/v1/runtime.proto
From 9c1972f55d234bc1b9a00e88202b975dc48e0086 Mon Sep 17 00:00:00 2001
From: kevinten <596823919@qq.com>
Date: Sun, 12 Dec 2021 19:13:22 +0800
Subject: [PATCH 2/3] refactor: refactor java-sdk modules
---
.../io/mosn/layotto/examples/file/File.java | 2 +-
.../layotto/examples/helloworld/Hello.java | 2 +-
.../examples/pubsub/publisher/Publisher.java | 2 +-
.../pubsub/subscriber/impl/RawSubscriber.java | 2 +-
.../layotto/examples/state/RedisCRUD.java | 3 +-
pom.xml | 12 +
sdk-domain/pom.xml | 5 +
.../v1/domain/ConfigurationRuntime.java | 59 ++
.../v1/domain/ConfigurationRxRuntime.java | 51 +-
.../sdk/runtime/v1/domain/FileRuntime.java | 10 +-
.../sdk/runtime/v1/domain/FileRxRuntime.java | 92 +++
.../sdk/runtime/v1/domain/HelloRxRuntime.java | 6 +-
.../v1/domain/InvocationRxRuntime.java | 54 ++
.../sdk/runtime/v1/domain/LockRxRuntime.java | 9 +-
.../sdk/runtime/v1/domain/PubSubRuntime.java | 9 +
.../runtime/v1/domain/PubSubRxRuntime.java | 77 +++
.../runtime/v1/domain/SequencerRxRuntime.java | 10 +-
.../sdk/runtime/v1/domain/StateRuntime.java | 3 +-
.../sdk/runtime/v1/domain/StateRxRuntime.java | 285 ++++++++
.../configuration/ConfigurationItem.java | 28 +-
.../ConfigurationRequestItem.java | 24 +-
.../ConfigurationRequestItemBuilder.java | 24 +-
.../SaveConfigurationRequest.java | 12 +-
.../configuration/SubConfigurationResp.java | 20 +-
.../v1/domain/file/DelFileRequest.java | 12 +-
.../sdk/runtime/v1/domain/file/FileInfo.java | 16 +-
.../v1/domain/file/GetFileRequest.java | 12 +-
.../v1/domain/file/GetFileResponse.java | 4 +-
.../v1/domain/file/GetMetaRequest.java | 12 +-
.../v1/domain/file/GetMeteResponse.java | 4 +-
.../v1/domain/file/ListFileRequest.java | 20 +-
.../v1/domain/file/ListFileResponse.java | 12 +-
.../v1/domain/file/PutFileRequest.java | 16 +-
.../v1/domain/invocation/HttpExtension.java | 19 +-
.../invocation/InvokeMethodRequest.java | 24 +-
.../v1/domain/invocation/InvokeResponse.java | 8 +-
.../v1/domain/lock/TryLockRequest.java | 12 +-
.../v1/domain/lock/TryLockResponse.java | 4 +-
.../runtime/v1/domain/lock/UnlockRequest.java | 8 +-
.../v1/domain/lock/UnlockResponse.java | 4 +-
.../sdk/runtime/v1/domain/package-info.java | 14 +
.../v1/domain/pubsub/PublishEventRequest.java | 20 +-
.../v1/domain/pubsub/TopicEventRequest.java | 36 +-
.../v1/domain/pubsub/TopicEventResponse.java | 4 +-
.../v1/domain/pubsub/TopicSubscription.java | 12 +-
.../v1/domain/state/SaveStateRequest.java | 8 +-
.../sdk/runtime/v1/domain/state/State.java | 24 +-
.../runtime/v1/domain/state/StateOptions.java | 6 +-
.../state/TransactionalStateOperation.java | 8 +-
.../state/TransactionalStateRequest.java | 8 +-
sdk-grpc/pom.xml | 28 +
.../layotto/v1/grpc/ExceptionHandler.java | 0
.../grpc}/callback/GrpcAppCallbackImpl.java | 8 +-
.../grpc}/callback/component/Component.java | 2 +-
.../callback/component/pubsub/Subscriber.java | 4 +-
.../component/pubsub/SubscriberRegistry.java | 2 +-
.../pubsub/SubscriberRegistryImpl.java | 2 +-
.../v1/grpc/converter}/PubsubConverter.java | 2 +-
.../io/mosn/layotto/v1/grpc/package-info.java | 11 +-
.../v1/grpc/stub/PooledStubManager.java | 0
.../io/mosn/layotto/v1/grpc/stub/RRPool.java | 1 +
.../v1/grpc/stub/SingleStubManager.java | 0
.../layotto/v1/grpc/stub/StubCreator.java | 1 -
.../layotto/v1/grpc/stub/StubManager.java | 0
sdk-infrastructure/pom.xml | 18 +
.../config/RuntimeProperties.java | 7 +-
.../exceptions/RuntimeClientException.java | 2 +-
.../exceptions/RuntimeError.java | 2 +-
.../v1/infrastructure/package-info.java | 15 +
.../serializer/AbstractSerializer.java | 3 +-
.../serializer/ObjectSerializer.java | 2 +-
.../infrastructure}/utils/NetworkUtils.java | 4 +-
.../v1/infrastructure/value}/ApiProtocol.java | 2 +-
.../v1/infrastructure}/value/Headers.java | 2 +-
sdk-reactor/pom.xml | 6 +-
.../reactor/AbstractLayottoReactorClient.java | 300 ---------
.../client/reactor/LayottoReactorClient.java | 171 -----
.../reactor/LayottoReactorClientGrpc.java | 624 ------------------
.../layotto/v1/config/BooleanProperty.java | 36 -
.../layotto/v1/config/GenericProperty.java | 41 --
.../layotto/v1/config/IntegerProperty.java | 36 -
.../io/mosn/layotto/v1/config/Properties.java | 89 ---
.../io/mosn/layotto/v1/config/Property.java | 109 ---
.../layotto/v1/exceptions/LayottoError.java | 83 ---
.../v1/exceptions/LayottoException.java | 203 ------
.../client/AbstractLayottoReactorClient.java | 261 ++++++++
.../client}/LayottoReactorClientBuilder.java | 33 +-
.../client/LayottoReactorClientGrpc.java | 540 +++++++++++++++
.../v1/{ => reactor}/client/package-info.java | 2 +-
.../serializer}/CloudEvent.java | 2 +-
.../serializer/DefaultObjectSerializer.java} | 17 +-
.../ExtensionObjectSerializer.java} | 48 +-
.../serializer/DefaultObjectSerializer.java | 49 --
.../serializer/LayottoObjectSerializer.java | 52 --
.../io/mosn/layotto/v1/utils/GrpcWrapper.java | 77 ---
.../sdk/reactor/v1/CoreCloudRuntimes.java | 32 -
.../main/java/spec/sdk/reactor/v1/README.md | 1 -
.../v1/domain/core/InvocationRuntimes.java | 184 ------
.../v1/domain/core/PubSubRuntimes.java | 55 --
.../reactor/v1/domain/core/StateRuntimes.java | 229 -------
.../sdk/reactor/v1/domain/package-info.java | 19 -
.../spec/sdk/reactor/v1/utils/TypeRef.java | 162 -----
.../v1/client/ReactorRuntimeClient.java} | 22 +-
sdk/pom.xml | 11 +-
.../layotto/v1/AbstractRuntimeClient.java | 21 +-
.../mosn/layotto/v1/RuntimeClientBuilder.java | 6 +-
.../io/mosn/layotto/v1/RuntimeClientGrpc.java | 47 +-
.../io/mosn/layotto/v1/RuntimeServerGrpc.java | 8 +-
.../layotto/v1/grpc/GrpcRuntimeClient.java | 2 +-
.../layotto/v1/serializer/JSONSerializer.java | 1 +
.../sdk/runtime/v1/client/RuntimeClient.java | 7 +
.../layotto/v1/RuntimeClientBuilderTest.java | 2 +-
.../io/mosn/layotto/v1/SubscriberTest.java | 6 +-
.../io/mosn/layotto/v1/mock/MySubscriber.java | 2 +-
.../v1/serializer/JSONSerializerTest.java | 1 +
115 files changed, 1897 insertions(+), 2946 deletions(-)
rename sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRxRuntime.java (50%)
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRxRuntime.java
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRxRuntime.java
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/LockRxRuntime.java (82%)
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRxRuntime.java
rename sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/enhanced/MetricsRuntimes.java => sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRxRuntime.java (72%)
create mode 100644 sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRxRuntime.java
create mode 100644 sdk-grpc/pom.xml
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/ExceptionHandler.java (100%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc}/callback/GrpcAppCallbackImpl.java (93%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc}/callback/component/Component.java (92%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc}/callback/component/pubsub/Subscriber.java (89%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc}/callback/component/pubsub/SubscriberRegistry.java (93%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc}/callback/component/pubsub/SubscriberRegistryImpl.java (97%)
rename {sdk/src/main/java/io/mosn/layotto/v1/grpc => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/converter}/PubsubConverter.java (99%)
rename sdk-reactor/src/main/java/spec/sdk/reactor/v1/EnhancedCloudRuntimes.java => sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java (70%)
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/stub/PooledStubManager.java (100%)
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/stub/RRPool.java (99%)
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/stub/SingleStubManager.java (100%)
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/stub/StubCreator.java (99%)
rename {sdk => sdk-grpc}/src/main/java/io/mosn/layotto/v1/grpc/stub/StubManager.java (100%)
create mode 100644 sdk-infrastructure/pom.xml
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/config/RuntimeProperties.java (89%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/exceptions/RuntimeClientException.java (98%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/exceptions/RuntimeError.java (95%)
create mode 100644 sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/serializer/AbstractSerializer.java (96%)
rename {sdk/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/serializer/ObjectSerializer.java (96%)
rename {sdk-reactor/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/utils/NetworkUtils.java (96%)
rename {sdk/src/main/java/io/mosn/layotto/v1/domain => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/value}/ApiProtocol.java (93%)
rename {sdk-reactor/src/main/java/io/mosn/layotto/v1 => sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure}/value/Headers.java (95%)
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/AbstractLayottoReactorClient.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClient.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/client/reactor/LayottoReactorClientGrpc.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/config/BooleanProperty.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/config/GenericProperty.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/config/IntegerProperty.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/config/Properties.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/config/Property.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/exceptions/LayottoError.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/exceptions/LayottoException.java
create mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/reactor/client/AbstractLayottoReactorClient.java
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/{client/reactor => reactor/client}/LayottoReactorClientBuilder.java (80%)
create mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/reactor/client/LayottoReactorClientGrpc.java
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/{ => reactor}/client/package-info.java (93%)
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/{domain => reactor/serializer}/CloudEvent.java (99%)
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/{config/StringProperty.java => reactor/serializer/DefaultObjectSerializer.java} (65%)
rename sdk-reactor/src/main/java/io/mosn/layotto/v1/{serializer/ObjectSerializer.java => reactor/serializer/ExtensionObjectSerializer.java} (80%)
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/serializer/DefaultObjectSerializer.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/serializer/LayottoObjectSerializer.java
delete mode 100644 sdk-reactor/src/main/java/io/mosn/layotto/v1/utils/GrpcWrapper.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/CoreCloudRuntimes.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/README.md
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/InvocationRuntimes.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/PubSubRuntimes.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/StateRuntimes.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/package-info.java
delete mode 100644 sdk-reactor/src/main/java/spec/sdk/reactor/v1/utils/TypeRef.java
rename sdk-reactor/src/main/java/spec/sdk/{reactor/v1/client/CloudRuntimesClient.java => runtime/reactor/v1/client/ReactorRuntimeClient.java} (53%)
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 86cf20b..2626f68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,9 @@
sdk
sdk-reactor
spec
+ sdk-grpc
sdk-domain
+ sdk-infrastructure
@@ -48,11 +50,21 @@
runtime-spec-pb
${project.version}
+
+ io.mosn.layotto
+ runtime-sdk-grpc
+ ${project.version}
+
io.mosn.layotto
runtime-sdk-domain
${project.version}
+
+ io.mosn.layotto
+ runtime-sdk-infrastructure
+ ${project.version}
+
diff --git a/sdk-domain/pom.xml b/sdk-domain/pom.xml
index b0a8162..12d6f93 100644
--- a/sdk-domain/pom.xml
+++ b/sdk-domain/pom.xml
@@ -19,6 +19,11 @@
+
+ io.mosn.layotto
+ runtime-sdk-infrastructure
+
+
io.projectreactor
reactor-core
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
index 89ba2c7..fa8c16d 100644
--- 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
@@ -14,5 +14,64 @@
*/
package spec.sdk.runtime.v1.domain;
+import org.reactivestreams.Publisher;
+import org.reactivestreams.Subscription;
+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 {@link 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-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRxRuntime.java
similarity index 50%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRxRuntime.java
index 7c63716..f0b6b61 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/core/ConfigurationRuntimes.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/ConfigurationRxRuntime.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;
+package spec.sdk.runtime.v1.domain;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -20,50 +20,61 @@
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 spec.sdk.reactor.v1.utils.TypeRef;
import java.util.List;
-/**
- * Configuration Runtimes standard API defined.
- */
-public interface ConfigurationRuntimes {
+public interface ConfigurationRxRuntime extends ConfigurationRuntime {
/**
* Gets configuration from configuration store
*
- * @param The Type of the return.
* @param configurationRequestItem Request object.
- * @param type The Type needed as return for the call.
- * @return A Mono Plan of response with type T.
*/
- Mono>> getConfiguration(ConfigurationRequestItem configurationRequestItem,
- TypeRef type);
+ @Override
+ default List getConfiguration(ConfigurationRequestItem configurationRequestItem) {
+ return getConfigurationAsync(configurationRequestItem).block();
+ }
+
+ Mono> getConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
/**
* Saves configuration into configuration store.
+ * ø
*
* @param saveConfigurationRequest Request object.
- * @return A Mono Plan of invocation.
*/
- Mono saveConfiguration(SaveConfigurationRequest saveConfigurationRequest);
+ @Override
+ default void saveConfiguration(SaveConfigurationRequest saveConfigurationRequest) {
+ saveConfigurationAsync(saveConfigurationRequest).block();
+ }
+
+ Mono saveConfigurationAsync(SaveConfigurationRequest saveConfigurationRequest);
/**
* Deletes configuration from configuration store.
*
* @param configurationRequestItem Request object.
- * @return A Mono Plan of invocation.
*/
- Mono deleteConfiguration(ConfigurationRequestItem configurationRequestItem);
+ @Override
+ default void deleteConfiguration(ConfigurationRequestItem configurationRequestItem) {
+ deleteConfigurationAsync(configurationRequestItem).block();
+ }
+
+ Mono deleteConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
/**
* Gets configuration from configuration store and subscribe the updates.
*
- * @param The Type of the return.
* @param configurationRequestItem Request object.
- * @param type The Type needed as return for the call.
- * @return A Flux Plan of response with type T. Subscribe update listener.
*/
- Flux> subscribeConfiguration(ConfigurationRequestItem configurationRequestItem,
- TypeRef type);
+ @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/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRuntime.java
index b4c77db..82dd899 100644
--- a/sdk-domain/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-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRxRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRxRuntime.java
new file mode 100644
index 0000000..5f0631d
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/FileRxRuntime.java
@@ -0,0 +1,92 @@
+/*
+ * 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 reactor.core.publisher.Mono;
+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-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java
index 0204ad1..b38f325 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/HelloRxRuntime.java
@@ -26,5 +26,9 @@ default String sayHello(String name) {
Mono sayHelloAsync(String name);
@Override
- String sayHello(String name, int timeoutMillisecond);
+ default String sayHello(String name, int timeoutMillisecond) {
+ return sayHelloAsync(name, timeoutMillisecond).block();
+ }
+
+ Mono sayHelloAsync(String name, int timeoutMillisecond);
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRxRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/InvocationRxRuntime.java
new file mode 100644
index 0000000..a82af2f
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/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;
+
+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/src/main/java/spec/sdk/runtime/v1/domain/LockRxRuntime.java
similarity index 82%
rename from sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/LockRxRuntime.java
index 223b264..01f074c 100644
--- a/sdk-reactor/src/main/java/io/mosn/layotto/v1/value/LayottoApiProtocol.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/LockRxRuntime.java
@@ -12,12 +12,7 @@
* 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;
-/**
- * Transport protocol for Layotto's API.
- */
-public enum LayottoApiProtocol {
-
- GRPC;
+public interface LockRxRuntime extends LockRuntime {
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
index 37a3161..92b1bfd 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRuntime.java
@@ -14,6 +14,8 @@
*/
package spec.sdk.runtime.v1.domain;
+import spec.sdk.runtime.v1.domain.pubsub.PublishEventRequest;
+
import java.util.Map;
public interface PubSubRuntime {
@@ -49,4 +51,11 @@ public interface PubSubRuntime {
void publishEvent(String pubsubName, String topicName, byte[] data, Map metadata);
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-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRxRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRxRuntime.java
new file mode 100644
index 0000000..5d194bb
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/PubSubRxRuntime.java
@@ -0,0 +1,77 @@
+/*
+ * 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 reactor.core.publisher.Mono;
+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-reactor/src/main/java/spec/sdk/reactor/v1/domain/enhanced/MetricsRuntimes.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRxRuntime.java
similarity index 72%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/enhanced/MetricsRuntimes.java
rename to sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRxRuntime.java
index db5069b..b42be38 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/domain/enhanced/MetricsRuntimes.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/SequencerRxRuntime.java
@@ -12,13 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1.domain.enhanced;
+package spec.sdk.runtime.v1.domain;
-/**
- * Metrics Runtimes standard API defined.
- */
-public interface MetricsRuntimes {
-
- // TODO: 2021/8/31 API
- // see https://github.com/reactivegroup/cloud-runtimes-jvm/issues/2
+public interface SequencerRxRuntime extends SequencerRuntime {
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
index 859f2dc..8355a18 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRuntime.java
@@ -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.
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRxRuntime.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRxRuntime.java
new file mode 100644
index 0000000..a581ccc
--- /dev/null
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/StateRxRuntime.java
@@ -0,0 +1,285 @@
+/*
+ * 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 reactor.core.publisher.Mono;
+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/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
index 0ba4870..544f634 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationItem.java
@@ -16,25 +16,25 @@
import java.util.Map;
-public class ConfigurationItem {
+public class ConfigurationItem {
/**
* Required. The key of configuration item
*/
- private String key;
+ private String key;
/**
* 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.
*/
- private String group;
+ private String group;
/**
* The label of configuration item.
*/
- private String label;
+ private String label;
/**
* The tag list 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;
}
@@ -95,12 +95,12 @@ public void setMetadata(Map metadata) {
@Override
public String toString() {
return "ConfigurationItem{" +
- "key='" + key + '\'' +
- ", content=" + content +
- ", group='" + group + '\'' +
- ", label='" + label + '\'' +
- ", tags=" + tags +
- ", metadata=" + metadata +
- '}';
+ "key='" + key + '\'' +
+ ", content=" + content +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", tags=" + tags +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
index 08cbd52..a9fe513 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItem.java
@@ -25,24 +25,24 @@ public class ConfigurationRequestItem {
/**
* 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 group of keys.
*/
- private String group;
+ private String group;
/**
* The label for keys.
*/
- private String label;
+ private String label;
/**
* The keys to get.
*/
- private List keys;
+ private List keys;
/**
* The metadata which will be sent to configuration store components.
*/
@@ -99,12 +99,12 @@ public void setMetadata(Map metadata) {
@Override
public String toString() {
return "ConfigurationRequestItem{" +
- "storeName='" + storeName + '\'' +
- ", appId='" + appId + '\'' +
- ", group='" + group + '\'' +
- ", label='" + label + '\'' +
- ", keys=" + keys +
- ", metadata=" + metadata +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", keys=" + keys +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
index df9ff2c..d026ba2 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/ConfigurationRequestItemBuilder.java
@@ -22,15 +22,15 @@
*/
public class ConfigurationRequestItemBuilder {
- private final String storeName;
+ private final String storeName;
- private final String appId;
+ private final String appId;
- private String group;
+ private String group;
- private String label;
+ private String label;
- private List keys;
+ private List keys;
private Map metadata;
@@ -78,12 +78,12 @@ public ConfigurationRequestItem build() {
@Override
public String toString() {
return "ConfigurationRequestItemBuilder{" +
- "storeName='" + storeName + '\'' +
- ", appId='" + appId + '\'' +
- ", group='" + group + '\'' +
- ", label='" + label + '\'' +
- ", keys=" + keys +
- ", metadata=" + metadata +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", group='" + group + '\'' +
+ ", label='" + label + '\'' +
+ ", keys=" + keys +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
index 95cf0da..09ab8f9 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SaveConfigurationRequest.java
@@ -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-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
index 8744d5c..19b9be8 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/configuration/SubConfigurationResp.java
@@ -16,22 +16,22 @@
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,20 +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 +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", appId='" + appId + '\'' +
+ ", items=" + items +
+ '}';
}
}
diff --git a/sdk-domain/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
index 669a548..35afb53 100644
--- a/sdk-domain/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
@@ -19,8 +19,8 @@
public class DelFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -54,9 +54,9 @@ public void setMetaData(Map metaData) {
@Override
public String toString() {
return "DelFileRequest{" +
- "storeName='" + storeName + '\'' +
- ", fileName='" + fileName + '\'' +
- ", metaData=" + metaData +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
}
}
diff --git a/sdk-domain/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
index 466b112..8891609 100644
--- a/sdk-domain/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
@@ -19,9 +19,9 @@
public class FileInfo {
- private String fileName;
- private long size;
- private String lastModified;
+ private String fileName;
+ private long size;
+ private String lastModified;
private Map metaData;
public FileInfo(String fileName, long size, String lastModified, Map metaData) {
@@ -69,10 +69,10 @@ public void setMetaData(Map metaData) {
@Override
public String toString() {
return "FileInfo{" +
- "fileName='" + fileName + '\'' +
- ", size=" + size +
- ", lastModified='" + lastModified + '\'' +
- ", metaData=" + metaData +
- '}';
+ "fileName='" + fileName + '\'' +
+ ", size=" + size +
+ ", lastModified='" + lastModified + '\'' +
+ ", metaData=" + metaData +
+ '}';
}
}
diff --git a/sdk-domain/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
index d0bc541..86bc760 100644
--- a/sdk-domain/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
@@ -19,8 +19,8 @@
public class GetFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -54,9 +54,9 @@ public void setMetaData(Map metaData) {
@Override
public String toString() {
return "GetFileRequest{" +
- "storeName='" + storeName + '\'' +
- ", fileName='" + fileName + '\'' +
- ", metaData=" + metaData +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
}
}
diff --git a/sdk-domain/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
index 546b67d..21b4095 100644
--- a/sdk-domain/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
@@ -35,7 +35,7 @@ public void setIn(InputStream in) {
@Override
public String toString() {
return "GetFileResponse{" +
- "in=" + in +
- '}';
+ "in=" + in +
+ '}';
}
}
diff --git a/sdk-domain/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
index 69cc4e0..f7b071f 100644
--- a/sdk-domain/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
@@ -19,8 +19,8 @@
public class GetMetaRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
@@ -54,9 +54,9 @@ public void setMetaData(Map metaData) {
@Override
public String toString() {
return "GetMetaRequest{" +
- "storeName='" + storeName + '\'' +
- ", fileName='" + fileName + '\'' +
- ", metaData=" + metaData +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ '}';
}
}
diff --git a/sdk-domain/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
index c79d1f0..c5782b0 100644
--- a/sdk-domain/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
@@ -19,8 +19,8 @@
public class GetMeteResponse {
- private long size;
- private String lastModified;
+ private long size;
+ private String lastModified;
private Map meta;
public long getSize() {
diff --git a/sdk-domain/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
index ff8d6c1..d06d09d 100644
--- a/sdk-domain/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
@@ -19,12 +19,12 @@
public class ListFileRequest {
- private String storeName;
- private String name;
+ private String storeName;
+ private String name;
private Map metaData;
- private int pageSize;
- private String marker;
+ private int pageSize;
+ private String marker;
public String getStoreName() {
return storeName;
@@ -72,11 +72,11 @@ public void setMarker(String marker) {
@Override
public String toString() {
return "ListFileRequest{" +
- "storeName='" + storeName + '\'' +
- ", name='" + name + '\'' +
- ", metaData=" + metaData +
- ", pageSize=" + pageSize +
- ", marker='" + marker + '\'' +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", name='" + name + '\'' +
+ ", metaData=" + metaData +
+ ", pageSize=" + pageSize +
+ ", marker='" + marker + '\'' +
+ '}';
}
}
diff --git a/sdk-domain/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
index 7b0eb79..6f43170 100644
--- a/sdk-domain/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
@@ -18,8 +18,8 @@
public class ListFileResponse {
- private boolean isTruncated;
- private String marker;
+ private boolean isTruncated;
+ private String marker;
private FileInfo[] files;
@@ -53,9 +53,9 @@ public void setFiles(FileInfo[] files) {
@Override
public String toString() {
return "ListFileResponse{" +
- "isTruncated=" + isTruncated +
- ", marker='" + marker + '\'' +
- ", files=" + Arrays.toString(files) +
- '}';
+ "isTruncated=" + isTruncated +
+ ", marker='" + marker + '\'' +
+ ", files=" + Arrays.toString(files) +
+ '}';
}
}
\ No newline at end of file
diff --git a/sdk-domain/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
index 20edab5..e705609 100644
--- a/sdk-domain/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
@@ -20,12 +20,12 @@
public class PutFileRequest {
- private String storeName;
- private String fileName;
+ private String storeName;
+ private String fileName;
private Map metaData;
- private InputStream in;
+ private InputStream in;
public String getStoreName() {
return storeName;
@@ -65,10 +65,10 @@ public void setIn(InputStream in) {
@Override
public String toString() {
return "PutFileRequest{" +
- "storeName='" + storeName + '\'' +
- ", fileName='" + fileName + '\'' +
- ", metaData=" + metaData +
- ", in=" + in +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", fileName='" + fileName + '\'' +
+ ", metaData=" + metaData +
+ ", in=" + in +
+ '}';
}
}
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
index f7be833..9c0f38d 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/HttpExtension.java
@@ -14,7 +14,6 @@
*/
package spec.sdk.runtime.v1.domain.invocation;
-
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -29,27 +28,27 @@ public final class HttpExtension {
/**
* Convenience HttpExtension object for {@link HttpMethods#NONE} with empty queryString.
*/
- public static final HttpExtension NONE = new HttpExtension(HttpMethods.NONE);
+ public static final HttpExtension NONE = new HttpExtension(HttpMethods.NONE);
/**
* Convenience HttpExtension object for the {@link HttpMethods#GET} Verb with empty queryString.
*/
- public static final HttpExtension GET = new HttpExtension(HttpMethods.GET);
+ public static final HttpExtension GET = new HttpExtension(HttpMethods.GET);
/**
* Convenience HttpExtension object for the {@link HttpMethods#PUT} Verb with empty queryString.
*/
- public static final HttpExtension PUT = new HttpExtension(HttpMethods.PUT);
+ public static final HttpExtension PUT = new HttpExtension(HttpMethods.PUT);
/**
* Convenience HttpExtension object for the {@link HttpMethods#POST} Verb with empty queryString.
*/
- public static final HttpExtension POST = new HttpExtension(HttpMethods.POST);
+ public static final HttpExtension POST = new HttpExtension(HttpMethods.POST);
/**
* Convenience HttpExtension object for the {@link HttpMethods#DELETE} Verb with empty queryString.
*/
- public static final HttpExtension DELETE = new HttpExtension(HttpMethods.DELETE);
+ public static final HttpExtension DELETE = new HttpExtension(HttpMethods.DELETE);
/**
* Convenience HttpExtension object for the {@link HttpMethods#HEAD} Verb with empty queryString.
*/
- public static final HttpExtension HEAD = new HttpExtension(HttpMethods.HEAD);
+ public static final HttpExtension HEAD = new HttpExtension(HttpMethods.HEAD);
/**
* Convenience HttpExtension object for the {@link HttpMethods#CONNECT} Verb with empty queryString.
*/
@@ -61,12 +60,12 @@ public final class HttpExtension {
/**
* Convenience HttpExtension object for the {@link HttpMethods#TRACE} Verb with empty queryString.
*/
- public static final HttpExtension TRACE = new HttpExtension(HttpMethods.TRACE);
+ public static final HttpExtension TRACE = new HttpExtension(HttpMethods.TRACE);
/**
* HTTP verb.
*/
- private HttpMethods method;
+ private HttpMethods method;
/**
* HTTP query params.
@@ -76,7 +75,7 @@ public final class HttpExtension {
/**
* HTTP headers.
*/
- private Map headers;
+ private Map headers;
/**
* Construct a HttpExtension object.
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
index 78fde71..aa69737 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/invocation/InvokeMethodRequest.java
@@ -21,15 +21,15 @@
*/
public class InvokeMethodRequest {
- private final String appId;
+ private final String appId;
- private final String method;
+ private final String method;
- private Object body;
+ private Object body;
- private HttpExtension httpExtension;
+ private HttpExtension httpExtension;
- private String contentType;
+ private String contentType;
private Map metadata;
@@ -84,12 +84,12 @@ public void setMetadata(Map metadata) {
@Override
public String toString() {
return "InvokeMethodRequest{" +
- "appId='" + appId + '\'' +
- ", method='" + method + '\'' +
- ", body=" + body +
- ", httpExtension=" + httpExtension +
- ", contentType='" + contentType + '\'' +
- ", metadata=" + metadata +
- '}';
+ "appId='" + appId + '\'' +
+ ", method='" + method + '\'' +
+ ", body=" + body +
+ ", httpExtension=" + httpExtension +
+ ", contentType='" + contentType + '\'' +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/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
index 977c9ec..582ca95 100644
--- a/sdk-domain/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
@@ -17,7 +17,7 @@
public class InvokeResponse {
private String contentType;
- private T data;
+ private T data;
/**
* Getter method for property contentType.
@@ -58,8 +58,8 @@ public void setData(T data) {
@Override
public String toString() {
return "InvokeResponse{" +
- "contentType='" + contentType + '\'' +
- ", data=" + data +
- '}';
+ "contentType='" + contentType + '\'' +
+ ", data=" + data +
+ '}';
}
}
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
index 4932c92..35d03ec 100644
--- 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
@@ -19,7 +19,7 @@ public class TryLockRequest {
public String storeName;
public String resourceId;
public String lockOwner;
- public int expire;
+ public int expire;
public String getStoreName() {
return storeName;
@@ -56,10 +56,10 @@ public void setExpire(int expire) {
@Override
public String toString() {
return "TryLockRequest{" +
- "storeName='" + storeName + '\'' +
- ", resourceId='" + resourceId + '\'' +
- ", lockOwner='" + lockOwner + '\'' +
- ", expire=" + expire +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", resourceId='" + resourceId + '\'' +
+ ", lockOwner='" + lockOwner + '\'' +
+ ", expire=" + expire +
+ '}';
}
}
\ No newline at end of file
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
index 2719bb3..3f4a6e7 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/lock/TryLockResponse.java
@@ -29,7 +29,7 @@ public void setSuccess(boolean success) {
@Override
public String toString() {
return "TryLockResponse{" +
- "success=" + success +
- '}';
+ "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
index 9447943..437147f 100644
--- 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
@@ -47,9 +47,9 @@ public void setLockOwner(String lockOwner) {
@Override
public String toString() {
return "UnlockRequest{" +
- "storeName='" + storeName + '\'' +
- ", resourceId='" + resourceId + '\'' +
- ", lockOwner='" + lockOwner + '\'' +
- '}';
+ "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
index 850f698..ea67658 100644
--- 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
@@ -29,8 +29,8 @@ public void setStatus(UnlockResponseStatus status) {
@Override
public String toString() {
return "UnlockResponse{" +
- "status=" + status +
- '}';
+ "status=" + status +
+ '}';
}
public enum UnlockResponseStatus {
diff --git a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
index 1f9e6b9..97d0b69 100644
--- a/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
+++ b/sdk-domain/src/main/java/spec/sdk/runtime/v1/domain/package-info.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
/**
* 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)
diff --git a/sdk-domain/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
index 36acee7..a3cae43 100644
--- a/sdk-domain/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
@@ -20,14 +20,14 @@
public class PublishEventRequest {
// The name of the pubsub component
- private String pubsubName;
+ private String pubsubName;
// The pubsub topic
- private String topic;
+ private String topic;
// The data which will be published to topic.
- private byte[] data;
+ private byte[] data;
// The content type for the data (optional).
- private String contentType;
+ private String contentType;
// The metadata passing to pub components
//
@@ -128,11 +128,11 @@ public void setMetadata(Map metadata) {
@Override
public String toString() {
return "PublishEventRequest{" +
- "pubsubName='" + pubsubName + '\'' +
- ", topic='" + topic + '\'' +
- ", data=" + Arrays.toString(data) +
- ", contentType='" + contentType + '\'' +
- ", metadata=" + metadata +
- '}';
+ "pubsubName='" + pubsubName + '\'' +
+ ", topic='" + topic + '\'' +
+ ", data=" + Arrays.toString(data) +
+ ", contentType='" + contentType + '\'' +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/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
index 64c2db7..3888b96 100644
--- a/sdk-domain/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
@@ -22,32 +22,32 @@ 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.
- private String id;
+ private String id;
// source identifies the context in which an event happened.
// Often this will include information such as the type of the
// event source, the organization publishing the event or the process
// that produced the event. The exact syntax and semantics behind
// the data encoded in the URI is defined by the event producer.
- private String source;
+ private String source;
// The type of event related to the originating occurrence.
- private String type;
+ private String type;
// The version of the CloudEvents specification.
- private String specVersion;
+ private String specVersion;
// The content type of data value.
- private String contentType;
+ private String contentType;
// The content of the event.
- private byte[] data;
+ private byte[] data;
// The pubsub topic which publisher sent to.
- private String topic;
+ private String topic;
// The name of the pubsub the publisher sent to.
- private String pubsubName;
+ private String pubsubName;
// add a map to pass some extra properties.
private Map metadata;
@@ -217,15 +217,15 @@ public void setMetadata(Map 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 +
- '}';
+ "id='" + id + '\'' +
+ ", source='" + source + '\'' +
+ ", type='" + type + '\'' +
+ ", specVersion='" + specVersion + '\'' +
+ ", contentType='" + contentType + '\'' +
+ ", data=" + Arrays.toString(data) +
+ ", topic='" + topic + '\'' +
+ ", pubsubName='" + pubsubName + '\'' +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/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
index 0e39444..89a8ecf 100644
--- a/sdk-domain/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
@@ -39,7 +39,7 @@ public void setStatus(TopicEventResponseStatus status) {
@Override
public String toString() {
return "TopicEventResponse{" +
- "status=" + status +
- '}';
+ "status=" + status +
+ '}';
}
}
diff --git a/sdk-domain/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
index dce2ffa..2795b37 100644
--- a/sdk-domain/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
@@ -19,10 +19,10 @@
public class TopicSubscription {
// Required. The name of the pubsub containing the topic below to subscribe to.
- private String pubsubName;
+ private String pubsubName;
// Required. The name of topic which will be subscribed
- private String topic;
+ private String topic;
// The optional properties used for this topic's subscription e.g. session id
private Map metadata;
@@ -84,9 +84,9 @@ public void setMetadata(Map metadata) {
@Override
public String toString() {
return "TopicSubscription{" +
- "pubsubName='" + pubsubName + '\'' +
- ", topic='" + topic + '\'' +
- ", metadata=" + metadata +
- '}';
+ "pubsubName='" + pubsubName + '\'' +
+ ", topic='" + topic + '\'' +
+ ", metadata=" + metadata +
+ '}';
}
}
diff --git a/sdk-domain/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
index 7d5916f..e3075f8 100644
--- a/sdk-domain/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
@@ -21,7 +21,7 @@
*/
public class SaveStateRequest {
- private final String storeName;
+ private final String storeName;
private List> states;
@@ -54,8 +54,8 @@ public void setStates(List> states) {
@Override
public String toString() {
return "SaveStateRequest{" +
- "storeName='" + storeName + '\'' +
- ", states=" + states +
- '}';
+ "storeName='" + storeName + '\'' +
+ ", states=" + states +
+ '}';
}
}
diff --git a/sdk-domain/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
index 20084eb..6b05b81 100644
--- a/sdk-domain/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
@@ -26,17 +26,17 @@ public class State {
/**
* The key of the state.
*/
- private final String key;
+ private final String key;
/**
* The value of the state.
*/
- private final T value;
+ private final T value;
/**
* The ETag to be used Keep in mind that for some state stores (like redis) only numbers are supported.
*/
- private final String etag;
+ private final String etag;
/**
* The metadata which will be passed to state store component.
@@ -46,12 +46,12 @@ public class State {
/**
* The error in case the key could not be retrieved.
*/
- private final String error;
+ private final String error;
/**
* The options used for saving the state.
*/
- private final StateOptions options;
+ private final StateOptions options;
/**
* Create an immutable state reference to be retrieved or deleted. This Constructor CAN be used anytime you need to retrieve or delete a
@@ -208,12 +208,12 @@ public String getError() {
@Override
public String toString() {
return "State{" +
- "key='" + key + '\'' +
- ", value=" + value +
- ", etag='" + etag + '\'' +
- ", metadata=" + metadata +
- ", error='" + error + '\'' +
- ", options=" + options +
- '}';
+ "key='" + key + '\'' +
+ ", value=" + value +
+ ", etag='" + etag + '\'' +
+ ", metadata=" + metadata +
+ ", error='" + error + '\'' +
+ ", options=" + options +
+ '}';
}
}
diff --git a/sdk-domain/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
index 29f1c19..777f81d 100644
--- a/sdk-domain/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
@@ -41,9 +41,9 @@ public Consistency getConsistency() {
@Override
public String toString() {
return "StateOptions{" +
- "consistency=" + consistency +
- ", concurrency=" + concurrency +
- '}';
+ "consistency=" + consistency +
+ ", concurrency=" + concurrency +
+ '}';
}
public enum Consistency {
diff --git a/sdk-domain/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
index c0c624f..88eba26 100644
--- a/sdk-domain/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
@@ -24,7 +24,7 @@ public class TransactionalStateOperation {
/**
* State values to be operated on.
*/
- private final State request;
+ private final State request;
/**
* Construct an immutable transactional state operation object.
@@ -48,9 +48,9 @@ public State getRequest() {
@Override
public String toString() {
return "TransactionalStateOperation{" +
- "operation=" + operation +
- ", request=" + request +
- '}';
+ "operation=" + operation +
+ ", request=" + request +
+ '}';
}
public enum OperationType {
diff --git a/sdk-domain/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
index 3d08adb..7a0e3e9 100644
--- a/sdk-domain/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
@@ -28,7 +28,7 @@ public class TransactionalStateRequest {
/**
* Metadata used for transactional operations.
*/
- private final Map metadata;
+ private final Map metadata;
/**
* Constructor to create immutable transactional state request object.
@@ -62,8 +62,8 @@ public void putMetadata(String key, String value) {
@Override
public String toString() {
return "TransactionalStateRequest{" +
- "operations=" + operations +
- ", metadata=" + metadata +
- '}';
+ "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-reactor/src/main/java/spec/sdk/reactor/v1/EnhancedCloudRuntimes.java b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
similarity index 70%
rename from sdk-reactor/src/main/java/spec/sdk/reactor/v1/EnhancedCloudRuntimes.java
rename to sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
index 63f243b..9f57d34 100644
--- a/sdk-reactor/src/main/java/spec/sdk/reactor/v1/EnhancedCloudRuntimes.java
+++ b/sdk-grpc/src/main/java/io/mosn/layotto/v1/grpc/package-info.java
@@ -12,13 +12,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package spec.sdk.reactor.v1;
-
-import spec.sdk.reactor.v1.domain.enhanced.MetricsRuntimes;
-
-/**
- * Enhanced Cloud Runtimes standard API defined.
- */
-public interface EnhancedCloudRuntimes extends
- MetricsRuntimes {
-}
+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-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
new file mode 100644
index 0000000..e870801
--- /dev/null
+++ b/sdk-infrastructure/src/main/java/io/mosn/layotto/v1/infrastructure/package-info.java
@@ -0,0 +1,15 @@
+/*
+ * 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.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 5ce22fd..437ce5a 100644
--- a/sdk-reactor/pom.xml
+++ b/sdk-reactor/pom.xml
@@ -24,11 +24,7 @@
io.mosn.layotto
- runtime-spec-pb
-
-
- io.mosn.layotto
- runtime-sdk-domain
+ runtime-sdk-grpc
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 f440c8d..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.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 spec.sdk.runtime.v1.domain.invocation.HttpExtension;
-import spec.sdk.runtime.v1.domain.invocation.InvokeMethodRequest;
-import spec.sdk.runtime.v1.domain.pubsub.PublishEventRequest;
-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 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