diff --git a/config/service_config.go b/config/service_config.go index 258de856e60ce8e037161a799e5b1ebadeadf31b..9bc86d600128f7beffb3972c3222e2bd459899f5 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -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 ... diff --git a/metadata/identifier/metadata_identifier.go b/metadata/identifier/metadata_identifier.go index f8591b71316085b7610fb56dc8a8733c60f56bb2..18b330ae083d55cf77330d19c144b2d4a6bde862 100644 --- a/metadata/identifier/metadata_identifier.go +++ b/metadata/identifier/metadata_identifier.go @@ -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) } diff --git a/metadata/identifier/service_metadata_identifier.go b/metadata/identifier/service_metadata_identifier.go index c29b1e2f3c67cd07516da523009452ed0f01d935..92c15704db3bb873b3aff26297643119f8835f45 100644 --- a/metadata/identifier/service_metadata_identifier.go +++ b/metadata/identifier/service_metadata_identifier.go @@ -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) } diff --git a/metadata/identifier/subscribe_metadata_identifier.go b/metadata/identifier/subscribe_metadata_identifier.go index f507032557979fbdebac6ba110a1d362d8c3685b..e599fc9e0da1962d60d0bde2646eed552e26e95d 100644 --- a/metadata/identifier/subscribe_metadata_identifier.go +++ b/metadata/identifier/subscribe_metadata_identifier.go @@ -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) } diff --git a/metadata/namemapping/dynamic/service_name_mapping.go b/metadata/mapping/dynamic/service_name_mapping.go similarity index 97% rename from metadata/namemapping/dynamic/service_name_mapping.go rename to metadata/mapping/dynamic/service_name_mapping.go index 85e94a89c72be2237b52b1c96329435371be2279..4cfac8f82887d0b101beaf55ae9ca84c124d30b3 100644 --- a/metadata/namemapping/dynamic/service_name_mapping.go +++ b/metadata/mapping/dynamic/service_name_mapping.go @@ -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} } diff --git a/metadata/namemapping/dynamic/service_name_mapping_test.go b/metadata/mapping/dynamic/service_name_mapping_test.go similarity index 100% rename from metadata/namemapping/dynamic/service_name_mapping_test.go rename to metadata/mapping/dynamic/service_name_mapping_test.go diff --git a/metadata/namemapping/memory/service_name_mapping.go b/metadata/mapping/memory/service_name_mapping.go similarity index 100% rename from metadata/namemapping/memory/service_name_mapping.go rename to metadata/mapping/memory/service_name_mapping.go diff --git a/metadata/namemapping/service_name_mapping.go b/metadata/mapping/service_name_mapping.go similarity index 98% rename from metadata/namemapping/service_name_mapping.go rename to metadata/mapping/service_name_mapping.go index 451a60d2cf5956cb42ac18b3ebf60e0d47c5b506..6caed9f0b48c1bb9c2f0f1026eb642f69bb31113 100644 --- a/metadata/namemapping/service_name_mapping.go +++ b/metadata/mapping/service_name_mapping.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package namemapping +package mapping import ( gxset "github.com/dubbogo/gost/container/set" diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index f563f2df31d070be3612de9a34d510d96e360382..220ef71daca47f46bdcd4b88b215970399a5da31 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -114,5 +114,4 @@ func mockInitProviderWithSingleRegistry() { } providerConfig.Services["MockService"].InitExported() config.SetProviderConfig(*providerConfig) - } diff --git a/metadata/service/inmemory/service_test.go b/metadata/service/inmemory/service_test.go index d68990b3fd9150233f1287292af629da7871e250..7d701cd6b9ce3b3f9264a9ab79322d810e680c64 100644 --- a/metadata/service/inmemory/service_test.go +++ b/metadata/service/inmemory/service_test.go @@ -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×tamp=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×tamp=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)