-
Notifications
You must be signed in to change notification settings - Fork 903
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
(WIP) ServiceDiscoveryRegistry implementation #491
Closed
Closed
Changes from 30 commits
Commits
Show all changes
141 commits
Select commit
Hold shift + click to select a range
f09c991
Add extensiong for metadata service
f1de848
Merge pull request #484 from apache/1.4
wongoo ad18357
Merge pull request #1 from apache/feature/dubbo-2.7.5
lzp0412 5811136
Merge remote-tracking branch 'origin/feature/dubbo-2.7.5' into featur…
ae7d706
support service discovery registry
8022392
fix synthesizer bug
9cbee58
add .asf.yaml to change gitbox behaviour
htynkn 8a3c02c
Update .asf.yaml
htynkn 71326c9
Merge branch 'feature/dubbo-2.7.5' of https://github.com/lzp0412/dubb…
682f405
Add dynamic
a5da721
rename service => service discovery
8b720aa
Merge develop
3aa0082
Merge pull request #2 from flycash/2.7.5-bk
lzp0412 569e2b6
1、add comments
212d886
merge develop
ffe69ca
Merge branch 'feature/dubbo-2.7.5' of github.com:apache/dubbo-go into…
08eb340
Export get BaseConfig
bcda4de
fix review comments
698c2b2
Merge remote-tracking branch 'remotes/dubbo-go/feature/dubbo-2.7.5' i…
4b8b4d7
Refactor service-discovery
1113bf1
Merge 2.7.5
3f1a52b
Merge pull request #4 from flycash/2.7.5-bk
lzp0412 731020d
add comments for directory
2264cda
add comments for directory
a784557
Add tests
266e0b6
Add extensiong for metadata service
ed5693f
Merge pull request #5 from flycash/2.7.5-bk
lzp0412 fc6bdfa
Modify the comment of Process method
ea89aec
add the comment of ConsistentHash
861a9cd
provider can get attachment in ctx
pantianying c6be554
fix
pantianying 9fb89ed
add the comment of ConsistentHash
7df8822
fix
e73f3bf
fix impl_test error
2e0e802
delete meaningless code
pantianying 393d12a
fix import error
aaeabc6
fix import error
d82e10f
fix ut
pantianying 84b38fe
Merge pull request #508 from pantianying/provider_getattachment_in_co…
AlexStocks 544036a
Merge pull request #1 from apache/develop
xianlezheng ebb1b0c
Fix “compile errors caused by unsupported import packages”
xianlezheng f87a292
fix
cb9045c
Fix “uncheck travis rules of go fmt”
xianlezheng 1433347
replace Uint32Slice
b22fc9f
replace Uint32Slice
99f6cf4
Merge pull request #515 from xianlezheng/develop
flycash 1737904
Merge pull request #506 from aliiohs/featue/addCommentForConsistentHash
AlexStocks dd2ff3e
remove lock from url
0f64e2c
format code
7a256e4
Merge pull request #4 from apache/develop
sxllwx ceba6d7
Wait for test
sxllwx 6b53a98
delete lot of stage, direct used one-stage
sxllwx 6bce310
push to test
sxllwx 5835e3c
reinit integrate test case
sxllwx 1c20fea
add main func for protocol/grpc/protoc-gen-dubbo/examples
sxllwx 496610a
Add integrate-test
sxllwx 47b9666
Fix travis integrate test case filepath mistake
sxllwx b6a5888
Drop ci-consumer unused package
sxllwx c109d8f
Add ci used current commit id
sxllwx 9a68bb4
Fix dockerfile mistake, and fast fail
sxllwx 385f267
Add more rich debug log
sxllwx a14978e
Fix to used travis env direct
sxllwx 4866c0c
Add check travis env
sxllwx eb46ba9
Fix dockerfile and build the latest code
sxllwx 7a225fc
Sync latest travis config
sxllwx 06a543b
Drop ci-consumer go.sum
sxllwx f83dade
Fix docker build multi args
sxllwx dc27a11
Delete used debug info
sxllwx df1a43d
Finish code
8e9c2b2
Fix mistake according comment
sxllwx a519203
Update go-client config
sxllwx b39f876
Update go-server config
sxllwx ea81831
Merge pull request #520 from sxllwx/docker_ci
AlexStocks 3afc4ba
Merge remote-tracking branch 'remotes/upstream/develop' into feature/…
71517ef
change go.mod
d1e5463
change comments
1df1165
feat: fix gitee code analysis shadow err
6f326a5
Add comments for common directory
watermelo 8ffc312
Opt: optimize url to string
watermelo 8822f2c
fmt the codes
watermelo f07be5c
Merge pull request #502 from aliiohs/feature/addCommentForMethod
zouyx 8581202
Fix ci bug
sxllwx 60ff0c4
Merge pull request #5 from apache/develop
sxllwx 9190c53
Merge branch 'develop' into docker_ci
sxllwx f9368d5
Add extra logic for Dockerfile
sxllwx 01ba749
Fix shell script name
sxllwx b0a1a4e
Fix Dockerfile BUG
sxllwx fd9fb38
Finish docker integrate ci
sxllwx cbb469e
Merge pull request #532 from sxllwx/docker_ci
sxllwx 4c2907b
Revert "Fix docker ci bug"
sxllwx 681a3fd
Merge pull request #533 from apache/revert-532-docker_ci
zouyx dcb4cc2
Merge pull request #6 from apache/develop
sxllwx bc76c31
local test pass
sxllwx 455eb4d
local test pass, and sync latest develop code
sxllwx 2a9b5fe
Merge pull request #534 from sxllwx/docker_ci
zouyx 168f944
Merge pull request #531 from watermelo/featue/optUrlToString
AlexStocks 47bba48
Opt: optimize error handling
watermelo def16af
Modify the order of import packages
watermelo 2ffbe96
Mod: modify the comments in the directory of common
watermelo 1800a67
feat: change %s to %+v
fdf51a1
Merge pull request #529 from georgehao/feat/issue514-fix-shadow-analysis
zouyx ed4e7ba
Modify the order of import packages
watermelo d3540d3
Merge branch 'featue/optLog' of https://github.com/watermelo/dubbo-go…
watermelo 6489acf
Mod: modify inappropriate comments after review
watermelo f763779
Merge develop and resolve conflict
d2eee54
Merge pull request #519 from flycash/remove-url-lock
flycash 67e8e41
add attribute into Invocation
cvictory 9659d25
Mod: modify inappropriate comments after review & merge develop branch
watermelo 5246e56
add default value of attribute
cvictory 51ec3df
Mod: modify inappropriate comments after review & merge develop branch
watermelo d0a770f
Merge branch 'featue/addCommentForCommon' of https://github.com/water…
watermelo 9432c7a
Merge pull request #530 from watermelo/featue/addCommentForCommon
zouyx 8c8c95c
Merge pull request #536 from watermelo/featue/optLog
fangyincheng 41c9d89
fix review issue: add default construct in
cvictory 39a84d9
Merge pull request #537 from cvictory/attribute_into_invocation
AlexStocks 7c87c2a
Merge branch 'feature/dubbo-2.7.5' of https://github.com/apache/dubbo…
flycash bdd9b71
Add UT
flycash 198ddc3
Merge nacos-meta
flycash 7e912e7
Merge pull request #6 from flycash/2.7.5
lzp0412 b968f7b
Add unregiste implementation
flycash 517b521
Add comments for config_center
z2z23n0 7d4f1ed
Merge pull request #545 from YuzeZhang/master
zouyx cc4d563
server start successfully
flycash bfb89b5
Merge pull request #8 from flycash/2.7.5
lzp0412 035d7d9
Fix bug: using EventPublishServiceDiscovery
flycash f993803
Merge develop
flycash 34775e5
Merge pull request #9 from flycash/2.7.5-bk
lzp0412 b760621
Add events and eventListener
flycash ed6b59b
Add events and eventListener
flycash e2da137
Add customizer
flycash 59eee39
Add customizer
flycash 2997c11
refactor MetadataService
flycash 16b6500
it can be found by java consumer
flycash a7d16a0
Resolve conflict
flycash 3984ffa
Merge branch 'feature/dubbo-2.7.5' into 2.7.5-bk
lzp0412 41615c3
Merge pull request #11 from flycash/2.7.5-bk
lzp0412 066dcdd
Add metadata service factory
flycash 61a5188
Merge branch '2.7.5-bk' of github.com:flycash/dubbo-go into 2.7.5-bk
flycash 658c0b9
Merge pull request #12 from flycash/2.7.5-bk
lzp0412 9d5d9e3
Invoke dubbo client success
flycash 7019888
Merge pull request #13 from flycash/2.7.5-bk
lzp0412 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 extension | ||
|
||
import ( | ||
perrors "github.com/pkg/errors" | ||
) | ||
|
||
import ( | ||
"github.com/apache/dubbo-go/registry/servicediscovery/instance" | ||
) | ||
|
||
var ( | ||
serviceInstanceSelectorMappings = make(map[string]func() instance.ServiceInstanceSelector) | ||
) | ||
|
||
func SetServiceInstanceSelector(name string, f func() instance.ServiceInstanceSelector) { | ||
serviceInstanceSelectorMappings[name] = f | ||
} | ||
|
||
func GetServiceInstanceSelector(name string) (instance.ServiceInstanceSelector, error) { | ||
serviceInstanceSelector, ok := serviceInstanceSelectorMappings[name] | ||
if !ok { | ||
return nil, perrors.New("Could not find service instance selector with" + | ||
"name:" + name) | ||
} | ||
return serviceInstanceSelector(), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 extension | ||
|
||
import "github.com/apache/dubbo-go/metadata/mapping" | ||
|
||
var ( | ||
nameMappings = make(map[string]func() mapping.ServiceNameMapping) | ||
) | ||
|
||
func SetServiceNameMapping(name string, creator func() mapping.ServiceNameMapping) { | ||
nameMappings[name] = creator | ||
} | ||
|
||
func GetServiceNameMapping(name string) mapping.ServiceNameMapping { | ||
creator, ok := nameMappings[name] | ||
if !ok { | ||
panic("Can not find the target service name mapping: " + name) | ||
} | ||
return creator() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,12 @@ type multiConfiger interface { | |
|
||
// BaseConfig is the common configuration for provider and consumer | ||
type BaseConfig struct { | ||
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"` | ||
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"` | ||
Remotes map[string]*RemoteConfig `yaml:"remote" json:"remote,omitempty"` | ||
ServiceDiscoveries map[string]*ServiceDiscoveryConfig `yaml:"service_discovery" json:"service_discovery,omitempty"` | ||
// application config | ||
ApplicationConfig *ApplicationConfig `yaml:"application" json:"application,omitempty" property:"application"` | ||
|
||
configCenterUrl *common.URL | ||
prefix string | ||
fatherConfig interface{} | ||
|
@@ -51,6 +56,17 @@ type BaseConfig struct { | |
fileStream *bytes.Buffer | ||
} | ||
|
||
func (c *BaseConfig) GetServiceDiscoveries(name string) (config *ServiceDiscoveryConfig, ok bool) { | ||
config, ok = c.ServiceDiscoveries[name] | ||
return | ||
} | ||
|
||
// GetRemoteConfig will return the remote's config with the name if found | ||
func (c *BaseConfig) GetRemoteConfig(name string) (config *RemoteConfig, ok bool) { | ||
config, ok = c.Remotes[name] | ||
return | ||
} | ||
|
||
// startConfigCenter will start the config center. | ||
// it will prepare the environment | ||
func (c *BaseConfig) startConfigCenter() error { | ||
|
@@ -63,7 +79,7 @@ func (c *BaseConfig) startConfigCenter() error { | |
if c.prepareEnvironment() != nil { | ||
return perrors.WithMessagef(err, "start config center error!") | ||
} | ||
//c.fresh() | ||
// c.fresh() | ||
return err | ||
} | ||
|
||
|
@@ -101,14 +117,14 @@ func (c *BaseConfig) prepareEnvironment() error { | |
return perrors.WithStack(err) | ||
} | ||
} | ||
//global config file | ||
// global config file | ||
mapContent, err := dynamicConfig.Parser().Parse(content) | ||
if err != nil { | ||
return perrors.WithStack(err) | ||
} | ||
config.GetEnvInstance().UpdateExternalConfigMap(mapContent) | ||
|
||
//appGroup config file | ||
// appGroup config file | ||
if len(appContent) != 0 { | ||
appMapConent, err := dynamicConfig.Parser().Parse(appContent) | ||
if err != nil { | ||
|
@@ -264,7 +280,7 @@ func setFieldValue(val reflect.Value, id reflect.Value, config *config.InmemoryC | |
if f.Kind() == reflect.Map { | ||
|
||
if f.Type().Elem().Kind() == reflect.Ptr { | ||
//initiate config | ||
// initiate config | ||
s := reflect.New(f.Type().Elem().Elem()) | ||
prefix := s.MethodByName("Prefix").Call(nil)[0].String() | ||
for _, pfx := range strings.Split(prefix, "|") { | ||
|
@@ -279,7 +295,7 @@ func setFieldValue(val reflect.Value, id reflect.Value, config *config.InmemoryC | |
|
||
} | ||
|
||
//iter := f.MapRange() | ||
// iter := f.MapRange() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete it? |
||
|
||
for _, k := range f.MapKeys() { | ||
v := f.MapIndex(k) | ||
|
@@ -314,7 +330,7 @@ func (c *BaseConfig) fresh() { | |
} | ||
|
||
func (c *BaseConfig) freshInternalConfig(config *config.InmemoryConfiguration) { | ||
//reflect to init struct | ||
// reflect to init struct | ||
tp := reflect.ValueOf(c.fatherConfig).Elem().Type() | ||
initializeStruct(tp, reflect.ValueOf(c.fatherConfig).Elem()) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete it?