Skip to content
Snippets Groups Projects
Commit f4400ef8 authored by watermelo's avatar watermelo
Browse files

Add: add comments for metadata direcotory

parent 4af26b99
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,6 @@ type BaseServiceMetadataIdentifier struct {
side string
}
// joinParams...
func joinParams(joinChar string, params []string) string {
var joinedStr string
for _, param := range params {
......@@ -47,7 +46,7 @@ func joinParams(joinChar string, params []string) string {
return joinedStr
}
// getIdentifierKey...
// getIdentifierKey gets metadata identifier key by @params
func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.serviceInterface +
constant.KEY_SEPARATOR + mdi.version +
......@@ -56,7 +55,7 @@ func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) str
joinParams(constant.KEY_SEPARATOR, params)
}
// getFilePathKey...
// getFilePathKey gets metadata file path key by @params
func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) string {
path := serviceToPath(mdi.serviceInterface)
......@@ -69,7 +68,6 @@ func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) strin
}
// serviceToPath...
func serviceToPath(serviceInterface string) string {
if serviceInterface == constant.ANY_VALUE {
return ""
......@@ -83,7 +81,6 @@ func serviceToPath(serviceInterface string) string {
}
//withPathSeparator...
func withPathSeparator(path string) string {
if len(path) != 0 {
path = constant.PATH_SEPARATOR + path
......
......@@ -17,17 +17,18 @@
package identifier
// The MetadataIdentifier is used to store method descriptor
type MetadataIdentifier struct {
application string
BaseMetadataIdentifier
}
// getIdentifierKey...
// getIdentifierKey gets metadata identifier key by @mdi.application
func (mdi *MetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.application)
}
// getIdentifierKey...
// getIdentifierKey gets metadata file path key by @mdi.application
func (mdi *MetadataIdentifier) getFilePathKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.application)
}
......@@ -27,12 +27,12 @@ type ServiceMetadataIdentifier struct {
BaseMetadataIdentifier
}
// getIdentifierKey...
// getIdentifierKey gets metadata identifier key by @mdi.protocol and @mdi.revision
func (mdi *ServiceMetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.protocol + constant.KEY_REVISON_PREFIX + mdi.revision)
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.protocol, constant.KEY_REVISON_PREFIX, mdi.revision)
}
// getIdentifierKey...
// getFilePathKey gets metadata file path key by @mdi.protocol and @mdi.revision
func (mdi *ServiceMetadataIdentifier) getFilePathKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.protocol + constant.KEY_REVISON_PREFIX + mdi.revision)
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.protocol, constant.KEY_REVISON_PREFIX, mdi.revision)
}
......@@ -22,12 +22,12 @@ type SubscriberMetadataIdentifier struct {
BaseMetadataIdentifier
}
// getIdentifierKey...
// getIdentifierKey gets metadata identifier key by @mdi.revision
func (mdi *SubscriberMetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.revision)
}
// getIdentifierKey...
// getFilePathKey gets metadata file path key by @mdi.revision
func (mdi *SubscriberMetadataIdentifier) getFilePathKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.revision)
}
......@@ -22,6 +22,9 @@ import (
gxset "github.com/dubbogo/gost/container/set"
)
// Metadata service is a built-in service around the metadata of Dubbo services,
// whose interface is provided by Dubbo Framework and exported automatically before subscription after other services exporting,
// which may be used for Dubbo subscribers and admin.
type MetadataService interface {
ServiceName() string
ExportURL(url *common.URL) bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment