-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSentinelClusterConfigEntity.java
116 lines (93 loc) · 2.45 KB
/
SentinelClusterConfigEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.alibaba.csp.sentinel.dashboard.rule.entity;
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
import com.alibaba.csp.sentinel.slots.block.Rule;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
import java.util.Objects;
import java.util.Set;
/**
* 集群机器配置
*/
@Data
public class SentinelClusterConfigEntity {
@Data
private static class Common implements RuleEntity {
private String ip;
private Integer port;
private Date gmtCreate;
@Override
public Long getId() {
return null;
}
@Override
public void setId(Long id) {
}
@Override
public String getApp() {
return null;
}
@Override
public Rule toRule() {
return null;
}
public void initIpPort(String ip, int port) {
setIp(ip);
setPort(port);
}
}
@Data
public static class Mode extends Common {
/**
* 0-client
* 1-server
* -1 未指定
* {@link ClusterStateManager#CLUSTER_CLIENT}
*/
private Integer mode;
@JSONField(serialize = false)
public boolean isClientMode() {
return Objects.equals(this.mode, ClusterStateManager.CLUSTER_CLIENT);
}
@JSONField(serialize = false)
public boolean isServerMode() {
return Objects.equals(this.mode, ClusterStateManager.CLUSTER_SERVER);
}
}
@Data
public static class ClientConfig extends Common {
/**
* server的 ip
*/
private String serverHost;
/**
* server的 端口
*/
private Integer serverPort;
/**
* 请求超时时间 ms
*/
private Integer requestTimeout;
private Integer connectTimeout;
}
@Data
public static class ServerFlow extends Common {
/**
* 最大允许qps
*/
private Double maxAllowedQps;
}
@Data
public static class ServerTransport extends Common {
/**
* server的 端口
*/
private Integer serverPort;
private Integer idleSeconds;
}
@Data
public static class ServerNamespace extends Common {
private Set<String> namespaceSet;
}
}