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

Mod: modify inappropriate comments after review

parent f4400ef8
Branches
Tags
No related merge requests found
...@@ -25,11 +25,13 @@ import ( ...@@ -25,11 +25,13 @@ import (
"github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/constant"
) )
// BaseMetadataIdentifier defined for describe the Metadata base identify
type BaseMetadataIdentifier interface { type BaseMetadataIdentifier interface {
getFilePathKey(params ...string) string getFilePathKey(params ...string) string
getIdentifierKey(params ...string) string getIdentifierKey(params ...string) string
} }
// BaseMetadataIdentifier is the base implement of BaseMetadataIdentifier interface
type BaseServiceMetadataIdentifier struct { type BaseServiceMetadataIdentifier struct {
serviceInterface string serviceInterface string
version string version string
...@@ -37,6 +39,7 @@ type BaseServiceMetadataIdentifier struct { ...@@ -37,6 +39,7 @@ type BaseServiceMetadataIdentifier struct {
side string side string
} }
// joinParams will join the specified char in slice, and build as string
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 {
...@@ -46,7 +49,7 @@ func joinParams(joinChar string, params []string) string { ...@@ -46,7 +49,7 @@ func joinParams(joinChar string, params []string) string {
return joinedStr return joinedStr
} }
// getIdentifierKey gets metadata identifier key by @params // getIdentifierKey will return string format as service:Version:Group:Side:param1:param2...
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 +
...@@ -55,7 +58,7 @@ func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) str ...@@ -55,7 +58,7 @@ func (mdi *BaseServiceMetadataIdentifier) getIdentifierKey(params ...string) str
joinParams(constant.KEY_SEPARATOR, params) joinParams(constant.KEY_SEPARATOR, params)
} }
// getFilePathKey gets metadata file path key by @params // getFilePathKey will return string format as metadata/path/Version/Group/Side/param1/param2...
func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) string { func (mdi *BaseServiceMetadataIdentifier) getFilePathKey(params ...string) string {
path := serviceToPath(mdi.serviceInterface) path := serviceToPath(mdi.serviceInterface)
......
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
package identifier package identifier
// The MetadataIdentifier is used to store method descriptor // MetadataIdentifier is inherit baseMetaIdentifier with Application name
type MetadataIdentifier struct { type MetadataIdentifier struct {
application string application string
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey gets metadata identifier key by @mdi.application // GetIdentifierKey will return string format as service:Version:Group:Side: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 gets metadata file path key by @mdi.application // GetFilePathKey will return string format as metadata/path/Version/Group/Side/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)
} }
...@@ -21,18 +21,19 @@ import ( ...@@ -21,18 +21,19 @@ import (
"github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/constant"
) )
// ServiceMetadataIdentifier is inherit baseMetaIdentifier with service params: Revision and Protocol
type ServiceMetadataIdentifier struct { type ServiceMetadataIdentifier struct {
revision string revision string
protocol string protocol string
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey gets metadata identifier key by @mdi.protocol and @mdi.revision // GetIdentifierKey will return string format as service:Version:Group:Side:Protocol:"revision"+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)
} }
// getFilePathKey gets metadata file path key by @mdi.protocol and @mdi.revision // GetFilePathKey will return string format as metadata/path/Version/Group/Side/Protocol/"revision"+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)
} }
...@@ -17,17 +17,18 @@ ...@@ -17,17 +17,18 @@
package identifier package identifier
// SubscriberMetadataIdentifier is inherit baseMetaIdentifier with service params: Revision
type SubscriberMetadataIdentifier struct { type SubscriberMetadataIdentifier struct {
revision string revision string
BaseMetadataIdentifier BaseMetadataIdentifier
} }
// getIdentifierKey gets metadata identifier key by @mdi.revision // GetIdentifierKey will return string format as service:Version:Group:Side: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)
} }
// getFilePathKey gets metadata file path key by @mdi.revision // GetFilePathKey will return string format as metadata/path/Version/Group/Side/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)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment