You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/08/22 09:17:18 UTC
[incubator-servicecomb-saga] 03/08: SCB-817 Updated the
pack-contracts protocal for TCC
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch SCB-665
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit 258c2de5189d002ff4ee6dc2be5ac4fd1bb3472b
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Thu Aug 16 10:52:19 2018 +0800
SCB-817 Updated the pack-contracts protocal for TCC
---
.../proto/{GrpcTxEvent.proto => GrpcCommon.proto} | 33 +----------------
.../{GrpcTxEvent.proto => GrpcTccEvent.proto} | 43 ++++++++++++----------
.../src/main/proto/GrpcTxEvent.proto | 11 +-----
3 files changed, 26 insertions(+), 61 deletions(-)
diff --git a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcCommon.proto
similarity index 58%
copy from pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
copy to pack-contracts/pack-contract-grpc/src/main/proto/GrpcCommon.proto
index d2c6f77..40a8db7 100644
--- a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
+++ b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcCommon.proto
@@ -19,15 +19,8 @@ syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.apache.servicecomb.saga.pack.contract.grpc";
-option java_outer_classname = "TxEventProto";
-service TxEventService {
- rpc OnConnected (GrpcServiceConfig) returns (stream GrpcCompensateCommand) {
- }
- rpc OnTxEvent (GrpcTxEvent) returns (GrpcAck) {}
- rpc OnDisconnected (GrpcServiceConfig) returns (GrpcAck) {
- }
-}
+// Define the common structs which could be use for TccEventService and SagaEventService
message GrpcServiceConfig {
string serviceName = 1;
@@ -37,27 +30,3 @@ message GrpcServiceConfig {
message GrpcAck {
bool aborted = 1;
}
-
-message GrpcTxEvent {
- int64 timestamp = 1;
- string globalTxId = 2;
- string localTxId = 3;
- string parentTxId = 4;
- string type = 5;
- string compensationMethod = 6;
- bytes payloads = 7;
- string serviceName = 8;
- string instanceId = 9;
- int32 timeout = 10;
- int32 retries = 11;
- string retryMethod = 12;
-}
-
-message GrpcCompensateCommand {
- string globalTxId = 1;
- string localTxId = 2;
- string parentTxId = 3;
- string compensationMethod = 4;
- bytes payloads = 5;
-}
-
diff --git a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTccEvent.proto
similarity index 60%
copy from pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
copy to pack-contracts/pack-contract-grpc/src/main/proto/GrpcTccEvent.proto
index d2c6f77..1eba5e5 100644
--- a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
+++ b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTccEvent.proto
@@ -19,45 +19,48 @@ syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.apache.servicecomb.saga.pack.contract.grpc";
-option java_outer_classname = "TxEventProto";
+option java_outer_classname = "TccEventProto";
-service TxEventService {
- rpc OnConnected (GrpcServiceConfig) returns (stream GrpcCompensateCommand) {
+import "GrpcCommon.proto";
+
+service TccEventService {
+ rpc participate(GrpcParticipateEvent) returns (GrpcAck) {}
+ rpc OnConnected (GrpcServiceConfig) returns (stream GrpcCordinateCommand) {
}
- rpc OnTxEvent (GrpcTxEvent) returns (GrpcAck) {}
+ rpc OnTransactionStarted (GrpcTransactionStartedEvent) returns (GrpcAck) {}
+ rpc OnTransactionEnded (GrpcTransactionEndedEvent) returns (GrpcAck) {}
rpc OnDisconnected (GrpcServiceConfig) returns (GrpcAck) {
}
}
-message GrpcServiceConfig {
- string serviceName = 1;
- string instanceId = 2;
+message GrpcTransactionStartedEvent {
+ int64 timestamp = 1;
+ string globalTxId = 2;
+ string localTxId = 3;
+ string parentTxId = 4;
}
-message GrpcAck {
- bool aborted = 1;
+message GrpcParticipateEvent {
+ int64 timestamp = 1;
+ string globalTxId = 2;
+ string localTxId = 3;
+ string parentTxId = 4;
+ string confirmMethod = 6;
+ string cancelMethod = 7;
}
-message GrpcTxEvent {
+message GrpcTransactionEndedEvent {
int64 timestamp = 1;
string globalTxId = 2;
string localTxId = 3;
string parentTxId = 4;
string type = 5;
- string compensationMethod = 6;
- bytes payloads = 7;
- string serviceName = 8;
- string instanceId = 9;
- int32 timeout = 10;
- int32 retries = 11;
- string retryMethod = 12;
}
-message GrpcCompensateCommand {
+message GrpcCordinateCommand {
string globalTxId = 1;
string localTxId = 2;
string parentTxId = 3;
- string compensationMethod = 4;
- bytes payloads = 5;
+ string type = 4;
}
diff --git a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
index d2c6f77..f037b4f 100644
--- a/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
+++ b/pack-contracts/pack-contract-grpc/src/main/proto/GrpcTxEvent.proto
@@ -21,6 +21,8 @@ option java_multiple_files = true;
option java_package = "org.apache.servicecomb.saga.pack.contract.grpc";
option java_outer_classname = "TxEventProto";
+import "GrpcCommon.proto";
+
service TxEventService {
rpc OnConnected (GrpcServiceConfig) returns (stream GrpcCompensateCommand) {
}
@@ -29,15 +31,6 @@ service TxEventService {
}
}
-message GrpcServiceConfig {
- string serviceName = 1;
- string instanceId = 2;
-}
-
-message GrpcAck {
- bool aborted = 1;
-}
-
message GrpcTxEvent {
int64 timestamp = 1;
string globalTxId = 2;