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 { ...@@ -37,7 +37,6 @@ type BaseServiceMetadataIdentifier struct {
side string side string
} }
// joinParams...
func joinParams(joinChar string, params []string) string { func joinParams(joinChar string, params []string) string {
var joinedStr string var joinedStr string
for _, param := range params { for _, param := range params {
...@@ -47,7 +46,7 @@ func joinParams(joinChar string, params []string) string { ...@@ -47,7 +46,7 @@ func joinParams(joinChar string, params []string) string {
return joinedStr return joinedStr
} }
// getIdentifierKey... // getIdentifierKey gets metadata identifier key by @params
func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) string { func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.serviceInterface + return mdi.serviceInterface +
constant.KEY_SEPARATOR + mdi.version + constant.KEY_SEPARATOR + mdi.version +
...@@ -56,7 +55,7 @@ func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) str ...@@ -56,7 +55,7 @@ func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) str
joinParams(constant.KEY_SEPARATOR, params) joinParams(constant.KEY_SEPARATOR, params)
} }
// getFilePathKey... // getFilePathKey gets metadata file path key by @params
func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) string { func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) string {
path := serviceToPath(mdi.serviceInterface) path := serviceToPath(mdi.serviceInterface)
...@@ -69,7 +68,6 @@ func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) strin ...@@ -69,7 +68,6 @@ func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) strin
} }
// serviceToPath...
func serviceToPath(serviceInterface string) string { func serviceToPath(serviceInterface string) string {
if serviceInterface == constant.ANY_VALUE { if serviceInterface == constant.ANY_VALUE {
return "" return ""
...@@ -83,7 +81,6 @@ func serviceToPath(serviceInterface string) string { ...@@ -83,7 +81,6 @@ func serviceToPath(serviceInterface string) string {
} }
//withPathSeparator...
func withPathSeparator(path string) string { func withPathSeparator(path string) string {
if len(path) != 0 { if len(path) != 0 {
path = constant.PATH_SEPARATOR + path path = constant.PATH_SEPARATOR + path
......
...@@ -17,17 +17,18 @@ ...@@ -17,17 +17,18 @@
package identifier package identifier
// The MetadataIdentifier is used to store method descriptor
type MetadataIdentifier struct { type MetadataIdentifier struct {
application string application string
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey... // getIdentifierKey gets metadata identifier key by @mdi.application
func (mdi *MetadataIdentifier) getIdentifierKey(params ...string) string { func (mdi *MetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.application) return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.application)
} }
// getIdentifierKey... // getIdentifierKey gets metadata file path key by @mdi.application
func (mdi *MetadataIdentifier) getFilePathKey(params ...string) string { func (mdi *MetadataIdentifier) getFilePathKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.application) return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.application)
} }
...@@ -27,12 +27,12 @@ type ServiceMetadataIdentifier struct { ...@@ -27,12 +27,12 @@ type ServiceMetadataIdentifier struct {
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey... // getIdentifierKey gets metadata identifier key by @mdi.protocol and @mdi.revision
func (mdi *ServiceMetadataIdentifier) getIdentifierKey(params ...string) string { 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 { 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 { ...@@ -22,12 +22,12 @@ type SubscriberMetadataIdentifier struct {
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey... // getIdentifierKey gets metadata identifier key by @mdi.revision
func (mdi *SubscriberMetadataIdentifier) getIdentifierKey(params ...string) string { func (mdi *SubscriberMetadataIdentifier) getIdentifierKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.revision) return mdi.BaseMetadataIdentifier.getIdentifierKey(mdi.revision)
} }
// getIdentifierKey... // getFilePathKey gets metadata file path key by @mdi.revision
func (mdi *SubscriberMetadataIdentifier) getFilePathKey(params ...string) string { func (mdi *SubscriberMetadataIdentifier) getFilePathKey(params ...string) string {
return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.revision) return mdi.BaseMetadataIdentifier.getFilePathKey(mdi.revision)
} }
...@@ -22,6 +22,9 @@ import ( ...@@ -22,6 +22,9 @@ import (
gxset "github.com/dubbogo/gost/container/set" 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 { type MetadataService interface {
ServiceName() string ServiceName() string
ExportURL(url *common.URL) bool ExportURL(url *common.URL) bool
......
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