Skip to content

Commit ebcd977

Browse files
committed
Update OpenSergo proto definition
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
1 parent cd26a8b commit ebcd977

File tree

5 files changed

+96
-57
lines changed

5 files changed

+96
-57
lines changed

src/main/java/io/opensergo/OpenSergoConfigKindRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import java.util.concurrent.ConcurrentHashMap;
1919
import java.util.concurrent.ConcurrentMap;
2020

21-
import io.opensergo.proto.faulttolerance.v1.FaultToleranceRule;
22-
import io.opensergo.proto.faulttolerance.v1.RateLimitStrategy;
21+
import io.opensergo.proto.fault_tolerance.v1.FaultToleranceRule;
22+
import io.opensergo.proto.fault_tolerance.v1.RateLimitStrategy;
2323
import io.opensergo.util.StringUtils;
2424

2525
/**

src/main/proto/common/v1/common.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package io.opensergo.proto.common.v1;
1919
option java_package = "io.opensergo.proto.common.v1";
2020
option java_outer_classname = "CommonProto";
2121
option java_multiple_files = true;
22-
option go_package = "github.com/opensergo/opensergo-control-plane/proto/common/v1";
22+
option go_package = "github.com/opensergo/opensergo-control-plane/pkg/proto/common/v1";
2323

2424
enum TimeUnit {
2525
// The time unit is not known.

src/main/proto/fault_tolerance/v1/fault_tolerance.proto

Lines changed: 74 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,76 +14,110 @@
1414

1515
syntax = "proto3";
1616

17-
package io.opensergo.proto.faulttolerance.v1;
17+
package io.opensergo.proto.fault_tolerance.v1;
1818

19-
option java_package = "io.opensergo.proto.faulttolerance.v1";
19+
option java_package = "io.opensergo.proto.fault_tolerance.v1";
2020
option java_outer_classname = "FaultToleranceProto";
2121
option java_multiple_files = true;
22-
option go_package = "github.com/opensergo/opensergo-control-plane/proto/fault_tolerance/v1";
22+
option go_package = "github.com/opensergo/opensergo-control-plane/pkg/proto/fault_tolerance/v1";
2323

2424
import "common/v1/common.proto";
2525

26+
import "validate/validate.proto";
27+
2628
// FaultToleranceRule
29+
message FaultToleranceRule {
30+
message FaultToleranceRuleTargetRef {
31+
string target_resource_name = 1;
32+
}
2733

28-
message FaultToleranceRuleTargetRef {
29-
string target_resource_name = 1;
30-
}
34+
message FaultToleranceStrategyRef {
35+
string name = 1;
36+
string kind = 2;
37+
}
3138

32-
message FaultToleranceStrategyRef {
33-
string name = 1;
34-
string kind = 2;
35-
}
36-
37-
message FaultToleranceActionRef {
38-
string name = 1;
39-
string kind = 2;
40-
}
39+
message FaultToleranceActionRef {
40+
string name = 1;
41+
string kind = 2;
42+
}
4143

42-
message FaultToleranceRule {
4344
repeated FaultToleranceRuleTargetRef targets = 1;
4445
repeated FaultToleranceStrategyRef strategies = 2;
4546
FaultToleranceActionRef action = 3;
4647
}
4748

4849
// RateLimitStrategy
49-
5050
message RateLimitStrategy {
51-
string name= 1;
51+
enum MetricType {
52+
TYPE_UNKNOWN = 0;
53+
TYPE_REQUEST_AMOUNT = 1;
54+
}
55+
56+
enum LimitMode {
57+
MODE_UNKNOWN = 0;
58+
MODE_LOCAL = 1;
59+
MODE_GLOBAL = 2;
60+
}
5261

53-
string metric_type = 2;
54-
string limit_mode = 3;
55-
int64 threshold = 4;
56-
int32 stat_duration = 5;
62+
string name = 1;
63+
64+
MetricType metric_type = 2;
65+
LimitMode limit_mode = 3;
66+
int64 threshold = 4 [(validate.rules).int64 = {gte: 0}];
67+
int32 stat_duration = 5 [(validate.rules).int32 = {gt: 0}];
5768
io.opensergo.proto.common.v1.TimeUnit stat_duration_time_unit = 6;
5869
}
5970

60-
// ConcurrencyLimitStrategy
71+
// ThrottlingStrategy
72+
message ThrottlingStrategy {
73+
string name = 1;
74+
75+
int64 min_interval_millis_of_requests = 2;
76+
int64 queue_timeout_millis = 3;
77+
}
6178

79+
// ConcurrencyLimitStrategy
6280
message ConcurrencyLimitStrategy {
63-
string limit_mode = 1;
64-
int64 max_concurrency = 2;
81+
enum LimitMode {
82+
MODE_UNKNOWN = 0;
83+
MODE_LOCAL = 1;
84+
MODE_GLOBAL = 2;
85+
}
86+
87+
string name = 1;
88+
89+
LimitMode limit_mode = 2;
90+
int64 max_concurrency = 3;
6591
}
6692

6793
// CircuitBreakerStrategy
94+
message CircuitBreakerStrategy {
95+
enum Strategy {
96+
STRATEGY_UNKNOWN = 0;
97+
STRATEGY_SLOW_REQUEST_RATIO = 1;
98+
STRATEGY_ERROR_REQUEST_RATIO = 2;
99+
}
68100

69-
message CircuitBreakerSlowCondition {
70-
int32 max_allowed_rt_millis = 1;
71-
}
101+
message CircuitBreakerSlowCondition {
102+
int32 max_allowed_rt_millis = 1;
103+
}
72104

73-
message CircuitBreakerErrorCondition {
105+
message CircuitBreakerErrorCondition {
74106

75-
}
107+
}
76108

77-
message CircuitBreakerStrategy {
78-
string strategy = 1;
79-
string trigger_ratio = 2;
80-
int64 stat_duration = 3;
81-
io.opensergo.proto.common.v1.TimeUnit stat_duration_time_unit = 4;
109+
string name = 1 [(validate.rules).string = {max_bytes: 1024}];
110+
111+
Strategy strategy = 2;
112+
double trigger_ratio = 3 [(validate.rules).double = {gte: 0.0, lte: 1.0}];
113+
int64 stat_duration = 4 [(validate.rules).int64 = {gt: 0}];
114+
io.opensergo.proto.common.v1.TimeUnit stat_duration_time_unit = 5;
82115

83-
int32 recovery_timeout = 5;
84-
io.opensergo.proto.common.v1.TimeUnit recovery_timeout_time_unit = 6;
85-
int32 min_request_amount = 7;
116+
int32 recovery_timeout = 6 [(validate.rules).int32 = {gt: 0}];
117+
io.opensergo.proto.common.v1.TimeUnit recovery_timeout_time_unit = 7;
118+
int32 min_request_amount = 8 [(validate.rules).int32 = {gt: 0}];
86119

87-
CircuitBreakerSlowCondition slow_condition = 8;
88-
CircuitBreakerErrorCondition error_condition = 9;
120+
CircuitBreakerSlowCondition slow_condition = 9;
121+
CircuitBreakerErrorCondition error_condition = 10;
89122
}
123+

src/main/proto/service_contract/v1/service_contract.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import "google/protobuf/timestamp.proto";
2121
option java_multiple_files = true;
2222
option java_package = "io.opensergo.proto.service_contract.v1";
2323
option java_outer_classname = "ServiceContractProto";
24-
option go_package = "github.com/opensergo/opensergo-go-sdk/proto/service_contract/v1";
24+
option go_package = "github.com/opensergo/opensergo-go-sdk/pkg/proto/service_contract/v1";
2525

2626
// MetadataService report metadata
2727
service MetadataService {

src/main/proto/transport/v1/protocol.proto

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package io.opensergo.proto.transport.v1;
1919
option java_package = "io.opensergo.proto.transport.v1";
2020
option java_outer_classname = "OpenSergoTransportProto";
2121
option java_multiple_files = true;
22-
option go_package = "github.com/opensergo/opensergo-control-plane/proto/transport/v1";
22+
option go_package = "github.com/opensergo/opensergo-control-plane/pkg/proto/transport/v1";
2323

2424
import "google/protobuf/any.proto";
2525

@@ -54,13 +54,14 @@ message SubscribeRequest {
5454
SubscribeRequestTarget target = 1;
5555
SubscribeOpType op_type = 2;
5656

57-
string version_info = 3;
58-
string response_ack = 4;
57+
string response_ack = 3;
5958

60-
repeated google.protobuf.Any attachments = 5;
59+
repeated google.protobuf.Any attachments = 4;
6160

6261
// client-to-server response status
63-
Status status = 6;
62+
Status status = 5;
63+
string identifier = 6;
64+
string request_id = 7;
6465
}
6566

6667
message ControlPlaneDesc {
@@ -72,16 +73,20 @@ message ControlPlaneDesc {
7273
message SubscribeResponse {
7374
Status status = 1;
7475

75-
// The version of the response data.
76-
string version_info = 2;
77-
string ack = 3;
76+
string ack = 2;
7877

79-
string namespace = 4;
80-
string app = 5;
81-
string kind = 6;
82-
repeated google.protobuf.Any data = 7;
78+
string namespace = 3;
79+
string app = 4;
80+
string kind = 5;
81+
DataWithVersion dataWithVersion = 6;
8382

84-
ControlPlaneDesc control_plane = 8;
83+
ControlPlaneDesc control_plane = 7;
84+
string response_id = 8;
85+
}
86+
87+
message DataWithVersion {
88+
repeated google.protobuf.Any data = 1;
89+
int64 version = 2;
8590
}
8691

8792
// OpenSergo Universal Transport Service (state-of-the-world)

0 commit comments

Comments
 (0)