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

Add: kubernetes registry and remote package unit test #400

Merged
merged 66 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
456f58f
Release 1.2.0
hxmhlt Oct 30, 2019
daa1fc3
Release 1.2.0
hxmhlt Oct 30, 2019
fe43eec
Merge branch 'master' into 1.2.0-release
hxmhlt Oct 30, 2019
11878c4
Release 1.2.0
hxmhlt Oct 30, 2019
55ab09e
Fix kubernetes import block and make map param
invalid-email-address Dec 20, 2019
32e5758
Fix the kubernetes && etcd registry race-condition
sxllwx Jan 13, 2020
723aa68
Fix bool value return
sxllwx Jan 13, 2020
2ec84e5
Delete the unused check block
sxllwx Jan 13, 2020
daac5e1
Add apache license
sxllwx Jan 13, 2020
347124d
Fix test embed etcd-server workdir
sxllwx Jan 13, 2020
460fed6
Delete the etcd test-server workdir after ut
sxllwx Jan 13, 2020
156bf40
Fix etcd work-dir conflict
sxllwx Jan 13, 2020
04ee311
fix latest issue
invalid-email-address Jan 18, 2020
5975ca0
Fix registry concurrent close panic
sxllwx Jan 19, 2020
00b1fb1
Merge pull request #289 from sxllwx/k8s
flycash Jan 24, 2020
7a71b3a
Merge develop branch
sxllwx Mar 13, 2020
4e5debc
Add ut for remote/kubernetes
sxllwx Mar 13, 2020
60eaf55
Delete unused method
sxllwx Mar 13, 2020
34ebc72
adapte for new registry
sxllwx Mar 13, 2020
29c8888
Add ut for registry/kubernetes
sxllwx Mar 13, 2020
f29c788
Fix ci client close race condition
sxllwx Mar 14, 2020
f11f6fb
Fix remote/kubernetes unit-test race condition
sxllwx Mar 14, 2020
e5c3ff5
Fix nil init
sxllwx Mar 14, 2020
9af6c53
Fix latest comment
sxllwx Mar 14, 2020
ae667e9
Fix latest alex comment
sxllwx Mar 14, 2020
059f9b8
Add double check for RWMutex
sxllwx Mar 14, 2020
d7ae998
Fix registry package unit test cover
sxllwx Mar 15, 2020
3349096
Add test cover for remote/kubernetes
sxllwx Mar 15, 2020
dfa8267
sync watch unit goroutine
sxllwx Mar 15, 2020
c7474fa
Fix method name bug,and handle the del event in config-listener.
sxllwx Mar 15, 2020
d776f8e
Fix remote/kubernetes sendMsg locker
sxllwx Mar 15, 2020
0886257
delete unused http pprof suite
sxllwx Mar 15, 2020
bf8bf85
Rename watcher and store name
sxllwx Mar 15, 2020
bc536bb
Fix named err
sxllwx Mar 15, 2020
7b13b44
Fix named err
sxllwx Mar 15, 2020
b9bf7d9
Fix time gap
sxllwx Mar 15, 2020
aee4f90
delete unused select case
sxllwx Mar 15, 2020
06b0da8
Add more rich log
sxllwx Mar 15, 2020
83d3975
move handle-client-restart from remote to registry
sxllwx Mar 15, 2020
603c1b9
Fix wg bug, add(1) out of goroutine
sxllwx Mar 15, 2020
8773a7d
Fix interest url slice-> map
sxllwx Mar 15, 2020
59fe063
Fix lock scop
sxllwx Mar 15, 2020
168a978
Fix kubernetes registry configListener nil condition
sxllwx Mar 15, 2020
92f9ea2
Fix zookeeper wg bug
sxllwx Mar 15, 2020
6b04b96
Fix create-path and push to test
sxllwx Mar 15, 2020
25f366c
Fix listener slice -> map
sxllwx Mar 15, 2020
5b87f8e
Fix missing protocol scheme bug
sxllwx Mar 15, 2020
b7af875
Fix nil point, the make slice will import a nil object in slice
sxllwx Mar 15, 2020
8941796
Merge pull request #1 from apache/develop
sxllwx Mar 15, 2020
1ed3e91
Fix go.sum conflict
sxllwx Mar 15, 2020
a47cf73
Fix go.sum conflict
sxllwx Mar 15, 2020
46f5c9a
Fix CHANGE.md
sxllwx Mar 15, 2020
d7a37ba
Fix CHANGE.md
sxllwx Mar 15, 2020
b88cf66
Mod: split long line codes
AlexStocks Mar 16, 2020
35624ed
Imp: set the init len for a map
AlexStocks Mar 16, 2020
eeaa817
Fix latest comment
sxllwx Mar 16, 2020
5a60988
Fix ci flow block issue
sxllwx Mar 16, 2020
14ba4ff
etcdv3 unit test, adapte for windows
sxllwx Mar 16, 2020
ab7db8a
simple the client validate method
sxllwx Mar 16, 2020
cef0d5d
short test time-cost for watch set
sxllwx Mar 16, 2020
938d5ed
Add more rich unit-test
sxllwx Mar 16, 2020
52a9e28
etcdv3 unit test, adapte for windows
sxllwx Mar 16, 2020
0769966
Fix ut nil pointer issue
sxllwx Mar 16, 2020
2eeb732
Fix kubernetes registry ut block issue
sxllwx Mar 16, 2020
164bf89
Fix kubernetes registry ut block issue
sxllwx Mar 16, 2020
e48b698
Add new registry block time, wait the watch groutine start
sxllwx Mar 16, 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
Prev Previous commit
Next Next commit
Fix interest url slice-> map
  • Loading branch information
sxllwx committed Mar 15, 2020
commit 8773a7d3160fd6da27230628f5d9d3ba6176979a
31 changes: 16 additions & 15 deletions registry/etcdv3/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ import (
)

type dataListener struct {
interestedURL []*common.URL
interestedURL map[string]*common.URL
listener config_center.ConfigurationListener
}

// NewRegistryDataListener ...
func NewRegistryDataListener(listener config_center.ConfigurationListener) *dataListener {
return &dataListener{listener: listener, interestedURL: []*common.URL{}}
return &dataListener{listener: listener, interestedURL: make(map[string]*common.URL, 16)}
}

func (l *dataListener) AddInterestedURL(url *common.URL) {
l.interestedURL = append(l.interestedURL, url)
if _, ok := l.interestedURL[url.String()]; ok {
return
}
l.interestedURL[url.String()] = url
}

func (l *dataListener) DataChange(eventType remoting.Event) bool {
Expand All @@ -56,20 +59,18 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
return false
}

for _, v := range l.interestedURL {
if serviceURL.URLEqual(*v) {
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
}
if _, ok := l.interestedURL[serviceURL.String()]; !ok {
return false
}

return false
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
}

type configurationListener struct {
Expand Down
33 changes: 18 additions & 15 deletions registry/kubernetes/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ import (
)

type dataListener struct {
interestedURL []*common.URL
interestedURL map[string]*common.URL
listener config_center.ConfigurationListener
}

// NewRegistryDataListener ...
func NewRegistryDataListener(listener config_center.ConfigurationListener) *dataListener {
return &dataListener{listener: listener}
return &dataListener{listener: listener, interestedURL: make(map[string]*common.URL, 16)}
}

func (l *dataListener) AddInterestedURL(url *common.URL) {
l.interestedURL = append(l.interestedURL, url)

if _, ok := l.interestedURL[url.String()]; ok {
return
}
l.interestedURL[url.String()] = url
}

func (l *dataListener) DataChange(eventType remoting.Event) bool {
Expand All @@ -56,20 +60,19 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
return false
}

for _, v := range l.interestedURL {
if serviceURL.URLEqual(*v) {
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
}
if _, ok := l.interestedURL[serviceURL.String()]; !ok {
return false
}

return false
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true

}

type configurationListener struct {
Expand Down
26 changes: 17 additions & 9 deletions registry/zookeeper/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,21 @@ import (

// RegistryDataListener ...
type RegistryDataListener struct {
interestedURL []*common.URL
interestedURL map[string]*common.URL
listener config_center.ConfigurationListener
}

// NewRegistryDataListener ...
func NewRegistryDataListener(listener config_center.ConfigurationListener) *RegistryDataListener {
return &RegistryDataListener{listener: listener, interestedURL: []*common.URL{}}
return &RegistryDataListener{listener: listener, interestedURL: make(map[string]*common.URL, 16)}
}

// AddInterestedURL ...
func (l *RegistryDataListener) AddInterestedURL(url *common.URL) {
l.interestedURL = append(l.interestedURL, url)
if _, ok := l.interestedURL[url.String()]; ok {
return
}
l.interestedURL[url.String()] = url
}

// DataChange ...
Expand All @@ -65,14 +68,19 @@ func (l *RegistryDataListener) DataChange(eventType remoting.Event) bool {
logger.Errorf("Listen NewURL(r{%s}) = error{%v} eventType.Path={%v}", url, err, eventType.Path)
return false
}
for _, v := range l.interestedURL {
if serviceURL.URLEqual(*v) {
l.listener.Process(&config_center.ConfigChangeEvent{Value: serviceURL, ConfigType: eventType.Action})
return true
}

if _, ok := l.interestedURL[serviceURL.String()]; !ok {
return false
}

return false
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
}

// RegistryConfigurationListener ...
Expand Down