Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nacos MetadataReport implementation #521

Closed
wants to merge 246 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
4af9282
Add:metadata report config
hxmhlt Feb 25, 2020
5ce2598
Add necessary interface definition
Mar 1, 2020
0bf2fca
Merge branch 'feature/dubbo-2.7.5' of github.com:apache/dubbo-go into…
Mar 1, 2020
23e1268
Upgrade gost
Mar 3, 2020
bc31a84
Merge pull request #385 from flycash/service-discovery
hxmhlt Mar 3, 2020
e35dffd
Merge remote-tracking branch 'apache/feature/dubbo-2.7.5' into metada…
hxmhlt Mar 3, 2020
dd2abb9
Add:interface definition of metadata
hxmhlt Mar 14, 2020
1f5bd64
Mod:recycle refer
hxmhlt Mar 14, 2020
28bcd48
Mod:resolve ci
hxmhlt Mar 14, 2020
d37f512
Mod:resolve conflict
hxmhlt Mar 14, 2020
c86b2f2
Merge pull request #405 from hxmhlt/metadata_report
hxmhlt Mar 15, 2020
3ce0905
parent bde7db3b33067ee4115ea3f8666ec1169226a5de
pantianying Mar 12, 2020
6ee83c7
repair according to code review
pantianying Mar 19, 2020
c0d143f
add license checker
zouyx Mar 20, 2020
31bc678
Improved code style
pantianying Mar 20, 2020
0dcd48f
Publish Config
Mar 21, 2020
16274df
Fix import
Mar 21, 2020
47db94d
Merge dubbo2.7.5 branch
Mar 21, 2020
2402b8e
Merge develop
Mar 21, 2020
9d47547
Merge pull request #442 from flycash/devTo2.7.5
hxmhlt Mar 21, 2020
9edd794
complement UT
pantianying Mar 22, 2020
6e574cc
Add:format dir
hxmhlt Mar 22, 2020
79218a1
Mod:resolve conflict
hxmhlt Mar 22, 2020
50a1609
code optimization
pantianying Mar 22, 2020
ce2155e
Mod:enhance url init code
hxmhlt Mar 22, 2020
9102dd8
Mod:format code
hxmhlt Mar 22, 2020
4cced63
Merge branch 'code_enhance_of_urlinit' into metadata_report
hxmhlt Mar 22, 2020
485cd5f
Mod:format mod
hxmhlt Mar 22, 2020
7903d54
Del:rm osx in travis.yml
hxmhlt Mar 22, 2020
f8c3aed
Mod: readme.md & change.md
fangyincheng Mar 22, 2020
7382a11
Merge develop
Mar 22, 2020
5267222
Merge pull request #448 from fangyincheng/develop
fangyincheng Mar 22, 2020
9a2cc81
Merge pull request #443 from hxmhlt/code_enhance_of_urlinit
zouyx Mar 22, 2020
09db044
Mod:release key
hxmhlt Mar 22, 2020
c43d705
Merge pull request #452 from hxmhlt/code_enhance_of_urlinit
hxmhlt Mar 22, 2020
ffc8f7b
Fix review
Mar 23, 2020
c12ca7a
Fix Review
Mar 23, 2020
4657f3d
Add: GetInterface for rpc_service.go
fangyincheng Mar 23, 2020
010b249
add license checker to travis
zouyx Mar 24, 2020
5b7790c
fix travis problem
zouyx Mar 24, 2020
cd23859
fix script download problem
zouyx Mar 24, 2020
334774e
fix validate script problem
zouyx Mar 24, 2020
85b5500
fix validate script problem
zouyx Mar 24, 2020
adae0d7
Add publish config method into DynamicConfiguration
flycash Mar 24, 2020
0f17847
service name mapping support
Mar 24, 2020
21aa371
add before validate script and fix travis problem
zouyx Mar 24, 2020
59e4497
fix travis problem
zouyx Mar 24, 2020
913ebac
fix travis validate license problem
zouyx Mar 24, 2020
9ec288f
Merge branch 'develop' into feature/addLicenseChecker
zouyx Mar 24, 2020
bdfc980
fix travis problem and test license checker
zouyx Mar 24, 2020
9900e4d
add ignore file to .gitignore
zouyx Mar 24, 2020
83f1285
put validate license before before_ut.sh
zouyx Mar 24, 2020
a4423a3
Update .travis.yml
zouyx Mar 24, 2020
cfc29d4
Update config_reader.go
zouyx Mar 24, 2020
030a008
add comment for tagRouter Create
pantianying Mar 24, 2020
ffd7685
add comment
pantianying Mar 24, 2020
7fbea82
modify .gitignore
zouyx Mar 24, 2020
0a6462c
debug travis
zouyx Mar 24, 2020
c6b781c
modify travis script
zouyx Mar 24, 2020
ef257b6
modify travis script
zouyx Mar 24, 2020
2d90871
Update .travis.yml
zouyx Mar 25, 2020
b4df9ad
Update .gitignore
zouyx Mar 25, 2020
21512be
Fix Review
Mar 25, 2020
a17dfd6
move checker to /tmp
zouyx Mar 25, 2020
4ca4e0c
delete router util
pantianying Mar 26, 2020
4c6d523
delete old lisence
zouyx Mar 26, 2020
49223eb
fix import
pantianying Mar 26, 2020
9002b99
Merge pull request #415 from pantianying/tagRouter
zouyx Mar 26, 2020
2a60e2b
Merge pull request #433 from zouyx/feature/addLicenseChecker
fangyincheng Mar 26, 2020
95b4658
align 2.7.8: direct event dispatcher
Patrick0308 Mar 24, 2020
259e3c1
dispatcher in extension
Patrick0308 Mar 26, 2020
1167e74
Fix review
Mar 27, 2020
97c9c22
upgrade the dubbo-go architecture png
Mar 27, 2020
ee40cd4
changed the architecture png
Mar 28, 2020
04ee0b9
Mod: fix comments
fangyincheng Mar 28, 2020
f94b4ff
changed some short naming
Mar 28, 2020
8e2adc5
add unit test and move extension to observer
Patrick0308 Mar 29, 2020
357f536
fix import
Patrick0308 Mar 29, 2020
b910c18
add the architecture extend png.
Isaac-Zhang Mar 29, 2020
1479852
Merge pull request #454 from fangyincheng/improve-rpcservice
flycash Mar 29, 2020
e3e0ba9
implement the NacosServiceDiscovery
Mar 29, 2020
ea24b17
add default eventDispatch type and handle eventType is ptr
Patrick0308 Mar 30, 2020
c25cfee
optimized code
Patrick0308 Mar 31, 2020
1aaeb4c
Fix Review
Mar 31, 2020
9ab5068
Merge branch 'service-name' into nacos-discovery
Mar 31, 2020
fce412d
test nacos service discovery
Mar 31, 2020
cf0961c
use adapter model to modify restServer
Patrick0308 Mar 31, 2020
f8e2978
remove adapter
Patrick0308 Mar 31, 2020
baa1125
optimize header transmit in RestClient and RestServer
Patrick0308 Apr 1, 2020
690333b
Mod:resolve conflict
hxmhlt Apr 1, 2020
dacdada
add some comments
Patrick0308 Apr 1, 2020
9340e82
Merge pull request #457 from Isaac-Zhang/develop
zouyx Apr 1, 2020
6c44338
Test CRUD for instance methods
Apr 1, 2020
54d0509
Fix Review
Apr 1, 2020
0142254
Merge branch 'service-name' into nacos-discovery
Apr 1, 2020
e7999f5
modify some comments and when parsing parameters occurred error, retu…
Patrick0308 Apr 1, 2020
a606b64
modify comments
Patrick0308 Apr 1, 2020
6bd3ac6
remove new function
Patrick0308 Apr 1, 2020
dcc2d26
modify some comments
Patrick0308 Apr 1, 2020
c6e1507
Tested nacos discovery
Apr 1, 2020
ad958fa
modify some comments and modify some logger's message
Patrick0308 Apr 1, 2020
e3a4992
Merge pull request #453 from flycash/service-name
flycash Apr 2, 2020
e151ab2
Fix: bug of subscribe
hxmhlt Apr 2, 2020
2bdbce5
Fix: bug of subscribe
hxmhlt Apr 2, 2020
5e5c43b
Merge branch 'feature/dubbo-2.7.5' of github.com:apache/dubbo-go into…
Apr 2, 2020
093026b
Add comment
Apr 2, 2020
487c8b7
Mod: README.md
fangyincheng Apr 2, 2020
2925dd3
modify some comments and optimize code
Patrick0308 Apr 2, 2020
a782838
optimize some code and fix imports
Patrick0308 Apr 2, 2020
805ffd6
Merge pull request #462 from hxmhlt/fix_subscribe_bug
pantianying Apr 3, 2020
6c0afbe
Merge pull request #463 from fangyincheng/modify-readme
zouyx Apr 3, 2020
b2f70f6
Merge branch 'develop' into rest-modify
Patrick0308 Apr 3, 2020
7a5b916
optimized code
Patrick0308 Apr 4, 2020
183b70a
remove the category
Patrick0308 Apr 6, 2020
57c58d8
remove the reference url category
Patrick0308 Apr 6, 2020
7ab3493
Merge pull request #460 from Patrick0308/rest-modify
flycash Apr 7, 2020
64d8751
Fix: remove category key
hxmhlt Apr 7, 2020
284aa48
Merge pull request #465 from hxmhlt/rm_category_key
hxmhlt Apr 7, 2020
e10ef06
Modify registryProtocol as a singleton to fix graceful shutdown
CodingSinger Mar 17, 2020
d3f3af0
fix notification confusion caused by multiple references sharing the …
CodingSinger Mar 20, 2020
db27238
fix fmt failure
CodingSinger Mar 20, 2020
5e99201
use the once.do to init the registryprotocol
CodingSinger Mar 22, 2020
8588bda
use the once.do to init the registryprotocol
CodingSinger Mar 22, 2020
7a17cab
add mutex when use subscribed map
CodingSinger Mar 23, 2020
43972d9
fix comments
CodingSinger Mar 31, 2020
2d14439
fix comments
CodingSinger Mar 31, 2020
319ca56
fix comments
CodingSinger Mar 31, 2020
52354fb
fix the zk HandleClientRestart issues
CodingSinger Mar 31, 2020
9657b39
change some comments
CodingSinger Mar 31, 2020
c808d5c
change some comments
CodingSinger Mar 31, 2020
774bd01
remove unused import
CodingSinger Apr 3, 2020
68cc420
remove consumer category in referenceConfig
CodingSinger Apr 3, 2020
ff0f376
fix not delete the node when shutdown gracefully and compare the path
CodingSinger Apr 5, 2020
a530ed5
rm debug logs and fix ut
CodingSinger Apr 6, 2020
08e9d84
fix ut
CodingSinger Apr 6, 2020
ed2fa0c
Add:registry directory extension
hxmhlt Apr 7, 2020
54dc74a
Mod: upper RegistryDirectory for inherit
hxmhlt Apr 7, 2020
6b58f6c
Update registry/directory/directory.go
hxmhlt Apr 8, 2020
5d630ca
Update registry/directory/directory.go
hxmhlt Apr 8, 2020
57fa801
Update registry/directory/directory.go
hxmhlt Apr 8, 2020
34c52a1
Update registry/directory/directory.go
hxmhlt Apr 8, 2020
eac6b63
Add:new func type
hxmhlt Apr 8, 2020
a4e9a02
Merge branch 'extension_directory' of https://github.com/hxmhlt/dubbo…
hxmhlt Apr 8, 2020
8cc8060
Merge branch 'feature/dubbo-2.7.5' into metadata_report
hxmhlt Apr 8, 2020
bda0ddc
Merge pull request #432 from CodingSinger/BUG_FIX
pantianying Apr 8, 2020
8c42b4c
In memory service discovery support
Apr 8, 2020
6aedd1a
rename baseRegistry to nacosBaseRegistry
Apr 8, 2020
e4e5ff7
Merge pull request #461 from flycash/nacos-discovery
flycash Apr 8, 2020
c15a725
Add in-memory service-discovery support
Apr 8, 2020
0b0fde8
Add: add exporter
hxmhlt Apr 9, 2020
8d3329f
Merge branch 'develop' into metadata_report
hxmhlt Apr 9, 2020
ae5ec56
Merge branch 'feature/dubbo-2.7.5' into develop
hxmhlt Apr 9, 2020
a594afd
Merge pull request #470 from apache/develop
hxmhlt Apr 9, 2020
6a9591a
Add:identifier ut
hxmhlt Apr 9, 2020
b3dddc8
Mod: move service name mapping
hxmhlt Apr 9, 2020
863dd0f
Mod:make ut run
hxmhlt Apr 9, 2020
207e246
Mod:resolve conflict
hxmhlt Apr 9, 2020
74d6dd9
Mod:format
hxmhlt Apr 9, 2020
dc405a7
Add:liscense
hxmhlt Apr 9, 2020
cf80d06
Update: hessian2 & getty version
AlexStocks Apr 10, 2020
2622827
move global dispatcher to extension package
Patrick0308 Apr 10, 2020
ef06c72
Mod:dir rename
hxmhlt Apr 10, 2020
045f7f5
Merge remote-tracking branch 'upstream/feature/dubbo-2.7.5' into alig…
Patrick0308 Apr 11, 2020
b30bea6
Merge remote-tracking branch 'upstream/feature/dubbo-2.7.5' into alig…
Patrick0308 Apr 11, 2020
9e06cc2
add simplified attribute in registry config
Apr 11, 2020
eca5628
fix imports
Patrick0308 Apr 11, 2020
ef33eb1
go fmt
Apr 11, 2020
a8871fd
modify and add licenses
Patrick0308 Apr 11, 2020
5d380d0
Mod:import pkg rename
hxmhlt Apr 11, 2020
4ea624b
add license
Apr 11, 2020
01bbba5
improve code
Apr 11, 2020
b25b628
fix
Apr 11, 2020
c979fca
Merge pull request #466 from hxmhlt/extension_directory
hxmhlt Apr 11, 2020
2532b49
Mod: gofmt all go files
AlexStocks Apr 11, 2020
d6ab9d1
Add: license header
AlexStocks Apr 12, 2020
b330db7
Fix: add PATH_SEPARATOR
AlexStocks Apr 12, 2020
862bf03
Merge pull request #473 from divebomb/develop
AlexStocks Apr 12, 2020
0098b2b
fix
Apr 12, 2020
b57ba60
fix
Apr 12, 2020
71e2e17
Merge branch 'develop' into simplified
Apr 12, 2020
258a6e9
fix
Apr 12, 2020
8d92fcb
go mod
Apr 12, 2020
68602ee
add start provider with random port
zouyx Apr 12, 2020
c8f66ac
Merge pull request #474 from dubbo-x/simplified
flycash Apr 13, 2020
a4ee287
Merge pull request #455 from Patrick0308/align-2.7.5
flycash Apr 13, 2020
7c20ad3
Merge branch 'feature/dubbo-2.7.5' of github.com:apache/dubbo-go into…
Apr 13, 2020
6707dfb
Fix format
Apr 13, 2020
a2a3adc
modify test
zouyx Apr 13, 2020
3c19887
modify start provider with random port
zouyx Apr 14, 2020
cc1f480
modify start provider with random port
zouyx Apr 14, 2020
2810c63
modify test
zouyx Apr 14, 2020
f580027
Mod:rw problem
hxmhlt Apr 17, 2020
851966e
Merge branch 'feature/dubbo-2.7.5' into metadata_report
hxmhlt Apr 17, 2020
ace7899
Mod:rw problem
hxmhlt Apr 17, 2020
ceb0292
a little refactor
cch-4321 Apr 17, 2020
4521e09
Mod:rw problem
hxmhlt Apr 17, 2020
66aa1a0
Mod:rw problem
hxmhlt Apr 17, 2020
b4df125
extract router init to func
cch-4321 Apr 18, 2020
f9eeb8b
modify random port implement
zouyx Apr 18, 2020
5076a4f
fix test case error
zouyx Apr 18, 2020
422b678
Merge pull request #469 from flycash/inmemory-service-discovery
flycash Apr 19, 2020
5bdbf08
Merge pull request #481 from cch123/develop
flycash Apr 19, 2020
ad995d8
Add:add for resolve rw
hxmhlt Apr 20, 2020
59d0da3
merge develop to 1.4
wongoo Apr 20, 2020
50ad24f
Merge pull request #486 from wongoo/1.4
zouyx Apr 20, 2020
5067dae
Mod:treeset to skiplist
hxmhlt Apr 21, 2020
f595f50
Mod:resolve conflict
hxmhlt Apr 21, 2020
2ac672f
event_publishing_service_discovery.go init
Patrick0308 Apr 21, 2020
370681a
Merge pull request #471 from hxmhlt/metadata_report
flycash Apr 21, 2020
5b10451
implement GetConfigKeysByGroup
Apr 13, 2020
c8920d3
Fix travis
Apr 21, 2020
58dd5bd
Add comments for ServiceMethodLimiter
Apr 23, 2020
42dbf0d
Merge pull request #490 from flycash/doc-comments
flycash Apr 23, 2020
f04c170
Mod: add comment and modify log level
fangyincheng Apr 25, 2020
74212fd
modify implement
zouyx Apr 25, 2020
c556232
Merge pull request #475 from flycash/nacos-batch-bk
flycash Apr 26, 2020
5582a70
Add comments
Apr 27, 2020
b5d169c
Merge pull request #492 from fangyincheng/add-comment
flycash Apr 27, 2020
bc6cc20
Merge pull request #496 from flycash/doc-comments
flycash Apr 27, 2020
c05e5c1
modify implement
zouyx Apr 27, 2020
5d7a277
Merge branch 'develop' into feature/randomPort
zouyx Apr 27, 2020
af29f5b
travis trigger
zouyx Apr 27, 2020
e4fc89d
travis trigger
zouyx Apr 27, 2020
7711df8
change variable name
zouyx Apr 27, 2020
fcaa44a
fix review comments
zouyx Apr 28, 2020
94414e4
fix review comments
zouyx Apr 28, 2020
24e7205
Merge pull request #476 from zouyx/feature/randomPort
fangyincheng Apr 28, 2020
839e0dd
add EventPublishingServiceDiscovery constructor
Patrick0308 Apr 28, 2020
3189b65
Merge remote-tracking branch 'upstream/feature/dubbo-2.7.5' into even…
Patrick0308 Apr 28, 2020
530f563
Implement event dispatcher
Apr 28, 2020
9b41e95
Merge pull request #497 from flycash/2.7.5
flycash May 1, 2020
59365ec
Merge develop
May 2, 2020
6a558d8
Merge pull request #500 from flycash/2.7.5
zouyx May 2, 2020
a4cef09
Merge remote-tracking branch 'upstream/feature/dubbo-2.7.5' into even…
Patrick0308 May 6, 2020
99ac8c5
add Event
Patrick0308 May 6, 2020
b87dbe2
Add:metadata report delegate & remote metadata service
hxmhlt May 6, 2020
73f21fa
Mod:for ut
hxmhlt May 6, 2020
f7dd531
Mod:resolve conflict
hxmhlt May 6, 2020
2938f51
optimize code
Patrick0308 May 6, 2020
ada27e2
add unit tests and modify event struct
Patrick0308 May 8, 2020
9f7e1f3
fix imports
Patrick0308 May 8, 2020
c958389
Merge pull request #487 from Patrick0308/eventDispatchServiceDiscovery
zouyx May 12, 2020
9788244
Merge remote-tracking branch 'apache/feature/dubbo-2.7.5' into metada…
hxmhlt May 17, 2020
0048609
Mod:resolve pr review
hxmhlt May 17, 2020
235edf5
Mod:resolve pr review
hxmhlt May 17, 2020
df1a43d
Finish code
May 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ install: true

script:
- go fmt ./... && [[ -z `git status -s` ]]
- sh before_validate_license.sh
- chmod u+x /tmp/tools/license/license-header-checker
- /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- chmod u+x before_ut.sh && ./before_ut.sh
- go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
webhooks: https://oapi.dingtalk.com/robot/send?access_token=f5d6237f2c79db584e75604f7f88db1ce1673c8c0e98451217b28fde791e1d4f
webhooks: https://oapi.dingtalk.com/robot/send?access_token=f5d6237f2c79db584e75604f7f88db1ce1673c8c0e98451217b28fde791e1d4f
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Apache License, Version 2.0

Both extension module and layered project architecture is according to Apache Dubbo (including protocol layer, registry layer, cluster layer, config layer and so on), the advantage of this arch is as following: you can implement these layered interfaces in your own way, override the default implementation of dubbo-go by calling 'extension.SetXXX' of extension, complete your special needs without modifying the source code. At the same time, you are welcome to contribute implementation of useful extension to the community.

![frame design](https://raw.githubusercontent.com/wiki/dubbo/dubbo-go/dubbo-go%E4%BB%A3%E7%A0%81%E5%88%86%E5%B1%82%E8%AE%BE%E8%AE%A1.png)
![dubbo go extend](./doc/pic/arch/dubbo-go-ext.png)

If you wanna know more about dubbo-go, please visit this reference [Project Architeture design](https://github.com/apache/dubbo-go/wiki/dubbo-go-V1.0-design)

Expand Down
3 changes: 2 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Apache License, Version 2.0

基于dubbo的extension模块和分层的代码设计(包括 protocol layer, registry layer, cluster layer, config 等等)。我们的目标是:你可以对这些分层接口进行新的实现,并通过调用 extension 模块的“ extension.SetXXX ”方法来覆盖 dubbo-go [同 go-for-apache-dubbo ]的默认实现,以完成自己的特殊需求而无需修改源代码。同时,欢迎你为社区贡献有用的拓展实现。

![框架设计](https://raw.githubusercontent.com/wiki/dubbo/dubbo-go/dubbo-go%E4%BB%A3%E7%A0%81%E5%88%86%E5%B1%82%E8%AE%BE%E8%AE%A1.png)
![dubbo go extend](./doc/pic/arch/dubbo-go-ext.png)

关于详细设计请阅读 [code layered design](https://github.com/apache/dubbo-go/wiki/dubbo-go-V1.0-design)

Expand Down Expand Up @@ -108,6 +108,7 @@ Apache License, Version 2.0
* [For dubbo](https://github.com/apache/dubbo-go/pull/344)
* [For grpc](https://github.com/apache/dubbo-go/pull/397)


- 其他功能支持:
* 启动时检查
* 服务直连
Expand Down
26 changes: 26 additions & 0 deletions before_validate_license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

remoteLicenseCheckerPath="https://github.com/dubbogo/resources/raw/master/tools/license"
remoteLicenseCheckerName="license-header-checker"
remoteLicenseCheckerURL="${remoteLicenseCheckerPath}/${remoteLicenseCheckerName}"
remoteLicenseName="license.txt"
remoteLicenseURL="${remoteLicenseCheckerPath}/${remoteLicenseName}"

licensePath="/tmp/tools/license"
mkdir -p ${licensePath}
wget -P "${licensePath}" ${remoteLicenseCheckerURL}
wget -P "${licensePath}" ${remoteLicenseURL}
2 changes: 1 addition & 1 deletion cluster/router/condition/app_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ conditions:
assert.Nil(t, err)
assert.NotNil(t, appRouter)

rule, err := Parse(testYML)
rule, err := getRule(testYML)
assert.Nil(t, err)
appRouter.generateConditions(rule)

Expand Down
2 changes: 1 addition & 1 deletion cluster/router/condition/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type FileConditionRouter struct {
// NewFileConditionRouter Create file condition router instance with content ( from config file)
func NewFileConditionRouter(content []byte) (*FileConditionRouter, error) {
fileRouter := &FileConditionRouter{}
rule, err := Parse(string(content))
rule, err := getRule(string(content))
if err != nil {
return nil, perrors.Errorf("yaml.Unmarshal() failed , error:%v", perrors.WithStack(err))
}
Expand Down
2 changes: 1 addition & 1 deletion cluster/router/condition/listenable_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (l *listenableRouter) Process(event *config_center.ConfigChangeEvent) {
return
}

routerRule, err := Parse(content)
routerRule, err := getRule(content)
if err != nil {
logger.Errorf("Parse condition router rule fail,error:[%s] ", err)
return
Expand Down
9 changes: 4 additions & 5 deletions cluster/router/condition/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
)

import (
matcher "github.com/apache/dubbo-go/cluster/router/match"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/logger"
Expand Down Expand Up @@ -301,7 +300,7 @@ func (pair MatchPair) isMatch(value string, param *common.URL) bool {
if !pair.Matches.Empty() && pair.Mismatches.Empty() {

for match := range pair.Matches.Items {
if matcher.IsMatchGlobalPattern(match.(string), value, param) {
if isMatchGlobalPattern(match.(string), value, param) {
return true
}
}
Expand All @@ -310,7 +309,7 @@ func (pair MatchPair) isMatch(value string, param *common.URL) bool {
if !pair.Mismatches.Empty() && pair.Matches.Empty() {

for mismatch := range pair.Mismatches.Items {
if matcher.IsMatchGlobalPattern(mismatch.(string), value, param) {
if isMatchGlobalPattern(mismatch.(string), value, param) {
return false
}
}
Expand All @@ -319,12 +318,12 @@ func (pair MatchPair) isMatch(value string, param *common.URL) bool {
if !pair.Mismatches.Empty() && !pair.Matches.Empty() {
//when both mismatches and matches contain the same value, then using mismatches first
for mismatch := range pair.Mismatches.Items {
if matcher.IsMatchGlobalPattern(mismatch.(string), value, param) {
if isMatchGlobalPattern(mismatch.(string), value, param) {
return false
}
}
for match := range pair.Matches.Items {
if matcher.IsMatchGlobalPattern(match.(string), value, param) {
if isMatchGlobalPattern(match.(string), value, param) {
return true
}
}
Expand Down
20 changes: 17 additions & 3 deletions cluster/router/condition/router_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
package condition

import (
"gopkg.in/yaml.v2"
"strings"
)

import (
gxstrings "github.com/dubbogo/gost/strings"
)

import (
"github.com/apache/dubbo-go/cluster/router"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/yaml"
)

// RouterRule RouterRule config read from config file or config center
Expand All @@ -44,9 +50,9 @@ type RouterRule struct {
* =>
* 1.1.1.1
*/
func Parse(rawRule string) (*RouterRule, error) {
func getRule(rawRule string) (*RouterRule, error) {
r := &RouterRule{}
err := yaml.Unmarshal([]byte(rawRule), r)
err := yaml.UnmarshalYML([]byte(rawRule), r)
if err != nil {
return r, err
}
Expand All @@ -57,3 +63,11 @@ func Parse(rawRule string) (*RouterRule, error) {

return r, nil
}

// isMatchGlobalPattern Match value to param content by pattern
func isMatchGlobalPattern(pattern string, value string, param *common.URL) bool {
if param != nil && strings.HasPrefix(pattern, "$") {
pattern = param.GetRawParam(pattern[1:])
}
return gxstrings.IsMatchPattern(pattern, value)
}
14 changes: 12 additions & 2 deletions cluster/router/condition/router_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ package condition
import (
"testing"
)

import (
"github.com/stretchr/testify/assert"
)

func TestParse(t *testing.T) {
import (
"github.com/apache/dubbo-go/common"
)

func TestGetRule(t *testing.T) {
testyml := `
scope: application
runtime: true
Expand All @@ -36,7 +41,7 @@ conditions:
ip=127.0.0.1
=>
1.1.1.1`
rule, e := Parse(testyml)
rule, e := getRule(testyml)

assert.Nil(t, e)
assert.NotNil(t, rule)
Expand All @@ -50,3 +55,8 @@ conditions:
assert.Equal(t, false, rule.Dynamic)
assert.Equal(t, "", rule.Key)
}

func TestIsMatchGlobPattern(t *testing.T) {
url, _ := common.NewURL("dubbo://localhost:8080/Foo?key=v*e")
assert.Equal(t, true, isMatchGlobalPattern("$key", "value", &url))
}
63 changes: 0 additions & 63 deletions cluster/router/match/match_utils.go

This file was deleted.

2 changes: 1 addition & 1 deletion cluster/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type RouterFactory interface {
}

// RouterFactory Router create factory use for parse config file
type FIleRouterFactory interface {
type FileRouterFactory interface {
// NewFileRouters Create file router with config file
NewFileRouter([]byte) (Router, error)
}
Expand Down
47 changes: 47 additions & 0 deletions cluster/router/tag/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 tag

import (
"github.com/apache/dubbo-go/cluster/router"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
)

func init() {
extension.SetRouterFactory(constant.TagRouterName, NewTagRouterFactory)
}

type tagRouterFactory struct{}

// NewTagRouterFactory create a tagRouterFactory
func NewTagRouterFactory() router.RouterFactory {
return &tagRouterFactory{}
}

// NewRouter create a tagRouter by tagRouterFactory with a url
// The url contains router configuration information
func (c *tagRouterFactory) NewRouter(url *common.URL) (router.Router, error) {
return NewTagRouter(url)
}

// NewFileRouter create a tagRouter by profile content
func (c *tagRouterFactory) NewFileRouter(content []byte) (router.Router, error) {
return NewFileTagRouter(content)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package match
package tag

import (
"testing"
Expand All @@ -29,18 +29,11 @@ import (
"github.com/apache/dubbo-go/common"
)

func TestIsMatchInternalPattern(t *testing.T) {
assert.Equal(t, true, isMatchInternalPattern("*", "value"))
assert.Equal(t, true, isMatchInternalPattern("", ""))
assert.Equal(t, false, isMatchInternalPattern("", "value"))
assert.Equal(t, true, isMatchInternalPattern("value", "value"))
assert.Equal(t, true, isMatchInternalPattern("v*", "value"))
assert.Equal(t, true, isMatchInternalPattern("*ue", "value"))
assert.Equal(t, true, isMatchInternalPattern("*e", "value"))
assert.Equal(t, true, isMatchInternalPattern("v*e", "value"))
}

func TestIsMatchGlobPattern(t *testing.T) {
url, _ := common.NewURL("dubbo://localhost:8080/Foo?key=v*e")
assert.Equal(t, true, IsMatchGlobalPattern("$key", "value", &url))
func TestTagRouterFactory_NewRouter(t *testing.T) {
u1, err := common.NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0&enabled=true")
assert.Nil(t, err)
factory := NewTagRouterFactory()
tagRouter, e := factory.NewRouter(&u1)
assert.Nil(t, e)
assert.NotNil(t, tagRouter)
}
Loading