Skip to content
Snippets Groups Projects
Commit d6130292 authored by xg.gao's avatar xg.gao
Browse files

simplify and comment

parent d2e56380
No related branches found
No related tags found
No related merge requests found
......@@ -38,13 +38,12 @@ import (
)
func newProviderRegistryUrl(host string, port int) *common.URL {
url1 := common.NewURLWithOptions(
return common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithParams(url.Values{}),
common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)),
)
return url1
}
func newBaseMetadataIdentifier(side string) *identifier.BaseMetadataIdentifier {
......
......@@ -22,14 +22,39 @@ import (
"github.com/apache/dubbo-go/metadata/identifier"
)
// MetadataReport is an interface of remote metadata report
// MetadataReport is an interface of
// remote metadata report.
type MetadataReport interface {
// StoreProviderMetadata stores the metadata.
// Metadata includes the basic info of the server,
// provider info, and other user custom info.
StoreProviderMetadata(*identifier.MetadataIdentifier, string) error
// StoreConsumerMetadata stores the metadata.
// Metadata includes the basic info of the server,
// consumer info, and other user custom info.
StoreConsumerMetadata(*identifier.MetadataIdentifier, string) error
// SaveServiceMetadata saves the metadata.
// Metadata includes the basic info of the server,
// service info, and other user custom info.
SaveServiceMetadata(*identifier.ServiceMetadataIdentifier, common.URL) error
// RemoveServiceMetadata removes the metadata.
RemoveServiceMetadata(*identifier.ServiceMetadataIdentifier) error
// GetExportedURLs gets the urls.
// If not found, an empty list will be returned.
GetExportedURLs(*identifier.ServiceMetadataIdentifier) ([]string, error)
// SaveSubscribedData saves the urls.
// If not found, an empty str will be returned.
SaveSubscribedData(*identifier.SubscriberMetadataIdentifier, string) error
// GetSubscribedURLs gets the urls.
// If not found, an empty list will be returned.
GetSubscribedURLs(*identifier.SubscriberMetadataIdentifier) ([]string, error)
// GetServiceDefinition gets the service definition.
GetServiceDefinition(*identifier.MetadataIdentifier) (string, error)
}
......@@ -38,13 +38,12 @@ import (
)
func newProviderRegistryUrl(host string, port int) *common.URL {
url1 := common.NewURLWithOptions(
return common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithParams(url.Values{}),
common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)),
)
return url1
}
func newBaseMetadataIdentifier(side string) *identifier.BaseMetadataIdentifier {
......
......@@ -46,43 +46,39 @@ var (
)
func newProviderRegistryUrl(host string, port int) *common.URL {
url1 := common.NewURLWithOptions(
return common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithParams(url.Values{}),
common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)),
)
return url1
}
func newConsumerRegistryUrl(host string, port int) *common.URL {
url1 := common.NewURLWithOptions(
return common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithParams(url.Values{}),
common.WithParamsValue(constant.ROLE_KEY, strconv.Itoa(common.CONSUMER)),
)
return url1
}
func newProviderUrl(host string, port int, service string, protocol string) common.URL {
url1 := common.NewURLWithOptions(
return *common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithPath(service),
common.WithProtocol(protocol),
)
return *url1
}
func newConsumerUrl(host string, port int, service string, protocol string) common.URL {
url1 := common.NewURLWithOptions(
return *common.NewURLWithOptions(
common.WithIp(host),
common.WithPort(strconv.Itoa(port)),
common.WithPath(service),
common.WithProtocol(protocol),
)
return *url1
}
type testServer struct {
......
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