Skip to content
Snippets Groups Projects
Commit ad995d83 authored by vito.he's avatar vito.he
Browse files

Add:add for resolve rw

parent 66aa1a05
No related branches found
No related tags found
No related merge requests found
......@@ -75,10 +75,11 @@ type ServiceConfig struct {
unexported *atomic.Bool
exported *atomic.Bool
rpcService common.RPCService
cacheProtocol protocol.Protocol
cacheMutex sync.Mutex
exporters []protocol.Exporter
cacheProtocol protocol.Protocol
exportersLock sync.Mutex
exporters []protocol.Exporter
}
// Prefix ...
......
......@@ -23,12 +23,12 @@ type MetadataIdentifier struct {
BaseMetadataIdentifier
}
// getIdentifierKey will return string format as service:Version:Group:Side:Application
// GetIdentifierKey will return string format as service:Version:Group:Side:Application
func (mdi *MetadataIdentifier) GetIdentifierKey() string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.Application)
}
// getFilePathKey will return string format as metadata/path/Version/Group/Side/Application
// GetFilePathKey will return string format as metadata/path/Version/Group/Side/Application
func (mdi *MetadataIdentifier) GetFilePathKey() string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.Application)
}
......@@ -28,12 +28,12 @@ type ServiceMetadataIdentifier struct {
BaseMetadataIdentifier
}
// getIdentifierKey will return string format as service:Version:Group:Side:Protocol:"revision"+Revision
// GetIdentifierKey will return string format as service:Version:Group:Side:Protocol:"revision"+Revision
func (mdi *ServiceMetadataIdentifier) GetIdentifierKey() string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.Protocol, constant.KEY_REVISON_PREFIX+mdi.Revision)
}
// getFilePathKey will return string format as metadata/path/Version/Group/Side/Protocol/"revision"+Revision
// GetFilePathKey will return string format as metadata/path/Version/Group/Side/Protocol/"revision"+Revision
func (mdi *ServiceMetadataIdentifier) GetFilePathKey() string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.Protocol, constant.KEY_REVISON_PREFIX+mdi.Revision)
}
......@@ -23,12 +23,12 @@ type SubscriberMetadataIdentifier struct {
BaseMetadataIdentifier
}
// getIdentifierKey will return string format as service:Version:Group:Side:Revision
// GetIdentifierKey will return string format as service:Version:Group:Side:Revision
func (mdi *SubscriberMetadataIdentifier) GetIdentifierKey() string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.Revision)
}
// getFilePathKey will return string format as metadata/path/Version/Group/Side/Revision
// GetFilePathKey will return string format as metadata/path/Version/Group/Side/Revision
func (mdi *SubscriberMetadataIdentifier) GetFilePathKey() string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.Revision)
}
......@@ -31,7 +31,7 @@ import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/config"
"github.com/apache/dubbo-go/config_center"
"github.com/apache/dubbo-go/metadata/namemapping"
"github.com/apache/dubbo-go/metadata/mapping"
)
const (
......@@ -77,6 +77,6 @@ func (d *DynamicConfigurationServiceNameMapping) buildGroup(serviceInterface str
}
// NewServiceNameMapping will create an instance of DynamicConfigurationServiceNameMapping
func NewServiceNameMapping(dc config_center.DynamicConfiguration) namemapping.ServiceNameMapping {
func NewServiceNameMapping(dc config_center.DynamicConfiguration) mapping.ServiceNameMapping {
return &DynamicConfigurationServiceNameMapping{dc: dc}
}
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package namemapping
package mapping
import (
gxset "github.com/dubbogo/gost/container/set"
......
......@@ -114,5 +114,4 @@ func mockInitProviderWithSingleRegistry() {
}
providerConfig.Services["MockService"].InitExported()
config.SetProviderConfig(*providerConfig)
}
......@@ -63,11 +63,12 @@ func TestMetadataService(t *testing.T) {
version := "0.0.1"
protocol := "dubbo"
beanName := "UserProvider"
u, _ := common.NewURL(fmt.Sprintf("%v://127.0.0.1:20000/com.ikurento.user.UserProvider?anyhost=true&"+
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&"+
"environment=dev&interface=%v&ip=192.168.56.1&methods=GetUser&"+
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&"+
"side=provider&timeout=3000&timestamp=1556509797245&group=%v&version=%v&bean.name=%v", protocol, serviceName, group, version, beanName))
u, _ := common.NewURL(fmt.Sprintf(`%v://127.0.0.1:20000/com.ikurento.user.UserProvider?
anyhost=true&application=BDTService&category=providers&default.timeout=10000&
dubbo=dubbo-provider-golang-1.0.0&environment=dev&interface=%v&ip=192.168.56.1&
methods=GetUser&module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&
revision=0.0.1&side=provider&timeout=3000&timestamp=1556509797245&group=%v&
version=%v&bean.name=%v`, protocol, serviceName, group, version, beanName))
mts.ExportURL(u)
sets, _ := mts.GetExportedURLs(serviceName, group, version, protocol)
assert.Equal(t, 1, sets.Size())
......@@ -88,7 +89,9 @@ func TestMetadataService(t *testing.T) {
userProvider := &UserProvider{}
common.ServiceMap.Register(serviceName, protocol, userProvider)
mts.PublishServiceDefinition(u)
expected := `{"CanonicalName":"com.ikurento.user.UserProvider","CodeSource":"","Methods":[{"Name":"GetUser","ParameterTypes":["slice"],"ReturnType":"ptr","Parameters":null}],"Types":null}`
expected := `{"CanonicalName":"com.ikurento.user.UserProvider","CodeSource":"",
"Methods":[{"Name":"GetUser","ParameterTypes":["slice"],
"ReturnType":"ptr","Parameters":null}],"Types":null}`
def1, _ := mts.GetServiceDefinition(serviceName, group, version)
assert.Equal(t, def1, expected)
serviceKey := definition.ServiceDescriperBuild(serviceName, group, version)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment