Skip to content

Commit 8553d49

Browse files
committed
feat:improve import
1 parent 5bbf632 commit 8553d49

File tree

204 files changed

+2048
-1877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+2048
-1877
lines changed

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Contributing
22
---
3-
If you have good comments or suggestions, welcome to create [Issues](https://github.com/Tencent/polaris/issues) or [Pull Requests](https://github.com/Tencent/polaris/pulls)contribute to the polaris open source community. Polaris continues to recruit contributors, even if it is answering questions in the issue, or doing some simple bugfixes, it will be of great help to polaris.
3+
If you have good comments or suggestions, welcome to create [Issues](https://github.com/Tencent/polaris/issues) or [Pull Requests](https://github.com/Tencent/polaris/pulls) ,contribute to the polaris open source community. Polaris continues to recruit contributors, even if it is answering questions on the issue, or doing some simple bugfixes, it will be of great help to polaris.
44

5-
[Tencent Open Source Incentive Program](https://opensource.tencent.com/contribution) Encourage developers to participate and contribute, and look forward to your joining.
5+
[Tencent Open Source Incentive Programs](https://opensource.tencent.com/contribution) Encourage developers to participate and contribute, and look forward to your joining.
66

77
## Issue
88
#### For contributors
99

1010
Please ensure that the following conditions are met before submitting an issue:
1111

1212
* Must be a bug or new feature
13-
* Have searched in the issue, and did not find a similar issue or solution
13+
* Have searched on the issue, and did not find a similar issue or solution
1414
* When creating a new issue, please provide a detailed description, screenshot or short video to help us locate the problem
1515

1616
## Pull Request

Code-of-Conduct.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# PolarisMesh Community Code of Conduct
2-
PolarisMesh follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
32

3+
PolarisMesh follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
44

5-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the PolarisMesh Code of Conduct Committee via email: PolarisMesh_Community@qq.com
5+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the PolarisMesh Code
6+
of Conduct Committee via email: PolarisMesh_Community@qq.com

README-zh.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,5 @@ curl http://127.0.0.1:8090
171171

172172
详见:[CONTRIBUTING.md](CONTRIBUTING.md)
173173

174-
[腾讯开源激励计划](https://opensource.tencent.com/contribution) 鼓励开发者的参与和贡献,期待你的加入。
174+
[腾讯开源激励计划](https://opensource.tencent.com/contribution) 鼓励开发者的参与和贡献,期待你的加入。
175175

README.md

+20-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<img src="logo.svg" width="10%" height="10%" />
66

7-
English | [简体中文](./README-zh.md)
7+
English | [简体中文](./README-zh.md)
88

99
---
1010

@@ -20,7 +20,8 @@ Visit [website](https://polarismesh.cn) to learn more
2020

2121
## Introduction
2222

23-
Polaris is a cloud-native service discovery and governance center. It can be used to solve the problem of service connection, fault tolerance, traffic control and secure in distributed and microservice architecture.
23+
Polaris is a cloud-native service discovery and governance center. It can be used to solve the problem of service
24+
connection, fault tolerance, traffic control and secure in distributed and microservice architecture.
2425

2526
Functions:
2627

@@ -53,11 +54,13 @@ client:
5354

5455
ecosystem:
5556

56-
- [polaris-controller](https://github.com/PolarisMesh/polaris-controller): K8s Controller for Automatic Injection of K8s Service and Polaris Sidecar
57+
- [polaris-controller](https://github.com/PolarisMesh/polaris-controller): K8s Controller for Automatic Injection of K8s
58+
Service and Polaris Sidecar
5759
- [spring-cloud-polaris](https://github.com/PolarisMesh/spring-cloud-polaris): spring cloud integrates with polaris-java
5860
- [grpc-java-polaris](https://github.com/PolarisMesh/grpc-java-polaris): grpc-java integrates with polaris-java
5961
- [grpc-go-polaris](https://github.com/PolarisMesh/grpc-go-polaris): grpc-go integrates with polaris-go
60-
- [dubbo3/dubbo-go](https://github.com/polarismesh/examples/tree/main/dubbo3/dubbogo): dubbo-go integrates with polaris-go
62+
- [dubbo3/dubbo-go](https://github.com/polarismesh/examples/tree/main/dubbo3/dubbogo): dubbo-go integrates with
63+
polaris-go
6164
- [nginx-polaris](https://github.com/PolarisMesh/nginx-polaris): nginx integrates with polaris-cpp
6265

6366
others:
@@ -69,9 +72,9 @@ others:
6972

7073
### Preconditions
7174

72-
#### Prepare database
75+
#### Prepare database
7376

74-
Please download and install MySQL, version requirement >=5.7, download available here:
77+
Please download and install MySQL, version requirement >=5.7, download available here:
7578
https://dev.mysql.com/downloads/mysql/5.7.html
7679

7780
#### Import SQL script
@@ -80,7 +83,8 @@ Point Script: ./store/sqldb/scripts/polaris_server.sql, one can import through m
8083

8184
#### Prepare golang compile environment
8285

83-
Polaris server end needs golang compile environment, version number needs >=1.12, download available here: https://golang.org/dl/#featured.
86+
Polaris server end needs golang compile environment, version number needs >=1.12, download available
87+
here: https://golang.org/dl/#featured.
8488

8589
### Build
8690

@@ -89,7 +93,7 @@ chmod +x build.sh
8993
./build.sh
9094
```
9195

92-
After built, one can see 'polaris-server-release_${version}.tar.gz' package from the list.
96+
After built, one can see 'polaris-server-release_${version}.tar.gz' package from the list.
9397

9498
### Installation
9599

@@ -100,7 +104,8 @@ Obtain polaris-server-release_${version}.tar.gz, and unzip.
100104
#### Change polaris configuration
101105

102106
After unzipped, vi polaris-server.yaml, replace DB configuration's variable to real database information
103-
: ##DB_USER## (database username), ##DB_PWD##(database password), ##DB_ADDR##(database address), ##DB_NAME##(database name)
107+
: ##DB_USER## (database username), ##DB_PWD##(database password), ##DB_ADDR##(database address), ##DB_NAME##(database
108+
name)
104109

105110
#### Execute Installation Script
106111

@@ -112,15 +117,15 @@ chmod +x ./tool/*.sh
112117
./tool/p.sh
113118
```
114119

115-
After all, run ./p.sh, prompt Polaris Server, proof the installation is successful
120+
After all, run ./p.sh, prompt Polaris Server, proof the installation is successful
116121

117122
#### Verify installation
118123

119124
```shell script
120125
curl http://127.0.0.1:8090
121126
```
122127

123-
Return text is 'Polaris Server', proof features run smoothly
128+
Return text is 'Polaris Server', proof features run smoothly
124129

125130
## How to access
126131

@@ -157,7 +162,9 @@ Please scan the QR code to join the chat group.
157162

158163
## Contribution
159164

160-
If you have good comments or suggestions, please give us Issues or Pull Requests to contribute to improve the development experience of Polaris Mesh.
165+
If you have good comments or suggestions, please give us Issues or Pull Requests to contribute to improve the
166+
development experience of Polaris Mesh.
161167
<br>see details:[CONTRIBUTING.md](./CONTRIBUTING.md)
162168

163-
[Tencent Open Source Incentive Plan](https://opensource.tencent.com/contribution) encourages developers to participate and contribute. Look forward to your participation.
169+
[Tencent Open Source Incentive Plan](https://opensource.tencent.com/contribution) encourages developers to participate
170+
and contribute. Look forward to your participation.

apiserver/eurekaserver/access.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"strings"
2727

2828
"github.com/emicklei/go-restful"
29+
2930
api "github.com/polarismesh/polaris-server/common/api/v1"
3031
"github.com/polarismesh/polaris-server/common/utils"
3132
)
@@ -70,12 +71,12 @@ func (h *EurekaServer) addDiscoverAccess(ws *restful.WebService) {
7071
ws.Route(ws.PUT(fmt.Sprintf("/apps/{%s}/{%s}", ParamAppId, ParamInstId)).To(h.RenewInstance)).
7172
Param(ws.PathParameter(ParamAppId, "applicationId").DataType("string")).
7273
Param(ws.PathParameter(ParamInstId, "instanceId").DataType("string"))
73-
//Param(ws.QueryParameter(ParamStatus, "status").DataType("string"))
74+
// Param(ws.QueryParameter(ParamStatus, "status").DataType("string"))
7475
// 实例反注册
7576
ws.Route(ws.DELETE(fmt.Sprintf("/apps/{%s}/{%s}", ParamAppId, ParamInstId)).To(h.CancelInstance)).
7677
Param(ws.PathParameter(ParamAppId, "applicationId").DataType("string")).
7778
Param(ws.PathParameter(ParamInstId, "instanceId").DataType("string"))
78-
//状态变更
79+
// 状态变更
7980
ws.Route(ws.PUT(fmt.Sprintf("/apps/{%s}/{%s}/status", ParamAppId, ParamInstId)).To(h.UpdateStatus)).
8081
Param(ws.PathParameter(ParamAppId, "applicationId").DataType("string")).
8182
Param(ws.PathParameter(ParamInstId, "instanceId").DataType("string"))
@@ -97,7 +98,7 @@ func parseAcceptValue(acceptValue string) map[string]bool {
9798
return values
9899
}
99100

100-
//全量拉取服务实例信息
101+
// 全量拉取服务实例信息
101102
func (h *EurekaServer) GetAllApplications(req *restful.Request, rsp *restful.Response) {
102103
appsRespCache := h.worker.GetCachedAppsWithLoad()
103104
remoteAddr := req.Request.RemoteAddr
@@ -199,7 +200,7 @@ func writeResponse(acceptValues map[string]bool, appsRespCache *ApplicationsResp
199200
var err error
200201
if len(acceptValues) > 0 && (hasKey(acceptValues, restful.MIME_JSON) || hasKey(acceptValues, MIME_JSON_WILD)) {
201202
if len(appsRespCache.JsonBytes) > 0 {
202-
//直接使用只读缓存返回
203+
// 直接使用只读缓存返回
203204
rsp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON)
204205
rsp.WriteHeader(http.StatusOK)
205206
_, err = rsp.Write(appsRespCache.JsonBytes)
@@ -223,7 +224,7 @@ func writeResponse(acceptValues map[string]bool, appsRespCache *ApplicationsResp
223224
return err
224225
}
225226

226-
//增量拉取服务实例信息
227+
// 增量拉取服务实例信息
227228
func (h *EurekaServer) GetDeltaApplications(req *restful.Request, rsp *restful.Response) {
228229
appsRespCache := h.worker.GetDeltaApps()
229230
if nil == appsRespCache {
@@ -290,7 +291,7 @@ func checkRegisterRequest(registrationRequest *RegistrationRequest, req *restful
290291
return true
291292
}
292293

293-
//服务注册
294+
// 服务注册
294295
func (h *EurekaServer) RegisterApplication(req *restful.Request, rsp *restful.Response) {
295296
remoteAddr := req.Request.RemoteAddr
296297
appId := strings.ToUpper(req.PathParameter(ParamAppId))
@@ -349,7 +350,7 @@ func (h *EurekaServer) RegisterApplication(req *restful.Request, rsp *restful.Re
349350
writeHeader(int(code/1000), rsp)
350351
}
351352

352-
//人工进行状态更新
353+
// 人工进行状态更新
353354
func (h *EurekaServer) UpdateStatus(req *restful.Request, rsp *restful.Response) {
354355
remoteAddr := req.Request.RemoteAddr
355356
appId := req.PathParameter(ParamAppId)
@@ -371,7 +372,7 @@ func (h *EurekaServer) UpdateStatus(req *restful.Request, rsp *restful.Response)
371372
status := req.QueryParameter(ParamValue)
372373
log.Infof("[EUREKA-SERVER]received instance update request, client: %s, instId: %s, appId: %s, status: %s",
373374
remoteAddr, instId, appId, status)
374-
//check status
375+
// check status
375376
if status == StatusUnknown {
376377
writePolarisStatusCode(req, api.ExecuteSuccess)
377378
writeHeader(http.StatusOK, rsp)
@@ -433,7 +434,7 @@ func (h *EurekaServer) DeleteStatus(req *restful.Request, rsp *restful.Response)
433434
writeHeader(int(code/1000), rsp)
434435
}
435436

436-
//心跳上报
437+
// 心跳上报
437438
func (h *EurekaServer) RenewInstance(req *restful.Request, rsp *restful.Response) {
438439
remoteAddr := req.Request.RemoteAddr
439440
appId := req.PathParameter(ParamAppId)
@@ -467,7 +468,7 @@ func (h *EurekaServer) RenewInstance(req *restful.Request, rsp *restful.Response
467468
writeHeader(int(code/1000), rsp)
468469
}
469470

470-
//实例反注册
471+
// 实例反注册
471472
func (h *EurekaServer) CancelInstance(req *restful.Request, rsp *restful.Response) {
472473
appId := req.PathParameter(ParamAppId)
473474
remoteAddr := req.Request.RemoteAddr

apiserver/eurekaserver/model.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/polarismesh/polaris-server/common/model"
2929
)
3030

31-
//端口包装类
31+
// 端口包装类
3232
type PortWrapper struct {
3333
Port interface{} `json:"$" xml:",chardata"`
3434

@@ -100,14 +100,14 @@ func (p *PortWrapper) convertEnableValue() error {
100100
return fmt.Errorf("unknow type of enable value, type is %v", reflect.TypeOf(p.Enabled))
101101
}
102102

103-
//数据中心信息
103+
// 数据中心信息
104104
type DataCenterInfo struct {
105105
Clazz string `json:"@class" xml:"class,attr"`
106106

107107
Name string `json:"name" xml:"name"`
108108
}
109109

110-
//租约信息
110+
// 租约信息
111111
type LeaseInfo struct {
112112

113113
// Client settings
@@ -125,22 +125,22 @@ type LeaseInfo struct {
125125
ServiceUpTimestamp int `json:"serviceUpTimestamp" xml:"serviceUpTimestamp"`
126126
}
127127

128-
//实例注册请求
128+
// 实例注册请求
129129
type RegistrationRequest struct {
130130
Instance *InstanceInfo `json:"instance"`
131131
}
132132

133-
//服务拉取应答
133+
// 服务拉取应答
134134
type ApplicationsResponse struct {
135135
Applications *Applications `json:"applications"`
136136
}
137137

138-
//单个服务拉取响应
138+
// 单个服务拉取响应
139139
type ApplicationResponse struct {
140140
Application *Application `json:"application"`
141141
}
142142

143-
//单个服务实例拉取响应
143+
// 单个服务实例拉取响应
144144
type InstanceResponse struct {
145145
InstanceInfo *InstanceInfo `json:"instance" xml:"instance"`
146146
}
@@ -221,7 +221,7 @@ func (i *Metadata) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
221221
start.Attr = append(start.Attr, startLocalAttribute(key[1:], value))
222222
continue
223223
}
224-
//兼容,后续去掉
224+
// 兼容,后续去掉
225225
if strings.HasPrefix(key, attributeNotionCross) {
226226
start.Attr = append(start.Attr, startLocalAttribute(key[1:], value))
227227
continue
@@ -245,7 +245,7 @@ func (i *Metadata) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
245245
return e.Flush()
246246
}
247247

248-
//实例信息
248+
// 实例信息
249249
type InstanceInfo struct {
250250
XMLName struct{} `json:"-" xml:"instance"`
251251

@@ -297,11 +297,11 @@ type InstanceInfo struct {
297297

298298
ActionType string `json:"actionType" xml:"actionType"`
299299

300-
//实际的北极星实例模型, key为revision
300+
// 实际的北极星实例模型, key为revision
301301
RealInstances map[string]*model.Instance `json:"-" xml:"-"`
302302
}
303303

304-
//对实例进行拷贝
304+
// 对实例进行拷贝
305305
func (i *InstanceInfo) Clone(actionType string) *InstanceInfo {
306306
return &InstanceInfo{
307307
InstanceId: i.InstanceId,
@@ -331,7 +331,7 @@ func (i *InstanceInfo) Clone(actionType string) *InstanceInfo {
331331
}
332332
}
333333

334-
//判断实例是否发生变更
334+
// 判断实例是否发生变更
335335
func (i *InstanceInfo) Equals(another *InstanceInfo) bool {
336336
if len(i.RealInstances) != len(another.RealInstances) {
337337
return false
@@ -347,7 +347,7 @@ func (i *InstanceInfo) Equals(another *InstanceInfo) bool {
347347
return true
348348
}
349349

350-
//服务数据
350+
// 服务数据
351351
type Application struct {
352352
XMLName struct{} `json:"-" xml:"application"`
353353

@@ -362,15 +362,15 @@ type Application struct {
362362
StatusCounts map[string]int `json:"-" xml:"-"`
363363
}
364364

365-
//获取eureka实例
365+
// 获取eureka实例
366366
func (a *Application) GetInstance(instId string) *InstanceInfo {
367367
if len(a.InstanceMap) > 0 {
368368
return a.InstanceMap[instId]
369369
}
370370
return nil
371371
}
372372

373-
//服务列表
373+
// 服务列表
374374
type Applications struct {
375375
XMLName struct{} `json:"-" xml:"applications"`
376376

@@ -383,7 +383,7 @@ type Applications struct {
383383
ApplicationMap map[string]*Application `json:"-" xml:"-"`
384384
}
385385

386-
//获取eureka应用
386+
// 获取eureka应用
387387
func (a *Applications) GetApplication(appId string) *Application {
388388
if len(a.ApplicationMap) > 0 {
389389
return a.ApplicationMap[appId]

0 commit comments

Comments
 (0)