From f4400ef8778fe7b454e7a0b0b8f13ca0007bb59c Mon Sep 17 00:00:00 2001 From: watermelo <80680489@qq.com> Date: Sat, 6 Jun 2020 17:52:21 +0800 Subject: [PATCH] Add: add comments for metadata direcotory --- metadata/identifier/base_metadata_identifier.go | 7 ++----- metadata/identifier/metadata_identifier.go | 5 +++-- metadata/identifier/service_metadata_identifier.go | 8 ++++---- metadata/identifier/subscribe_metadata_identifier.go | 4 ++-- metadata/service.go | 3 +++ 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/metadata/identifier/base_metadata_identifier.go b/metadata/identifier/base_metadata_identifier.go index a31467105..963c3d1a5 100644 --- a/metadata/identifier/base_metadata_identifier.go +++ b/metadata/identifier/base_metadata_identifier.go @@ -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 diff --git a/metadata/identifier/metadata_identifier.go b/metadata/identifier/metadata_identifier.go index f3df8f365..e97795b4c 100644 --- a/metadata/identifier/metadata_identifier.go +++ b/metadata/identifier/metadata_identifier.go @@ -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) } diff --git a/metadata/identifier/service_metadata_identifier.go b/metadata/identifier/service_metadata_identifier.go index 373df0130..b89641caa 100644 --- a/metadata/identifier/service_metadata_identifier.go +++ b/metadata/identifier/service_metadata_identifier.go @@ -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) } diff --git a/metadata/identifier/subscribe_metadata_identifier.go b/metadata/identifier/subscribe_metadata_identifier.go index 321a216a3..917e8e630 100644 --- a/metadata/identifier/subscribe_metadata_identifier.go +++ b/metadata/identifier/subscribe_metadata_identifier.go @@ -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) } diff --git a/metadata/service.go b/metadata/service.go index d85703c95..89df68fb3 100644 --- a/metadata/service.go +++ b/metadata/service.go @@ -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 -- GitLab