Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
664e03f
refact metadata
FoghostCn Nov 22, 2023
bf150ce
fix cycle import
FoghostCn Nov 24, 2023
54116b3
Initially completed
FoghostCn Nov 25, 2023
dda0ba8
register success
FoghostCn Nov 28, 2023
f2134b4
refect serviceDiscoveryRegistry Server size api
FoghostCn Nov 29, 2023
20d02c0
move customizer to service discovery dir
FoghostCn Nov 29, 2023
d13afea
client call success
FoghostCn Dec 2, 2023
77983e5
mv metadata client to metadata dir
FoghostCn Dec 2, 2023
41f7474
refactor
FoghostCn Dec 5, 2023
5eadaae
refactor metadata exporter
FoghostCn Dec 11, 2023
2ac1b8e
mv metadata client to metadata dir
FoghostCn Dec 11, 2023
6b2fd9d
mv metadata info to metadata module
FoghostCn Dec 11, 2023
157e9c2
associate metadataReport with registry
FoghostCn Jan 2, 2024
8ab3557
unit test not done
FoghostCn Jan 4, 2024
a179a3d
update warn log
FoghostCn Jan 5, 2024
1a11af1
unit test tmp fix
FoghostCn Jan 5, 2024
c29963b
fix integrate_test
FoghostCn Jan 5, 2024
25d8711
fix some logic
FoghostCn Jan 8, 2024
e3ef66e
change RegistryType default value
FoghostCn Jan 9, 2024
88a537d
code review fix
FoghostCn Jan 15, 2024
328eeeb
change metadata to options style
FoghostCn Jan 16, 2024
d7097b1
fix unit test
FoghostCn Jan 16, 2024
5c6e8d7
fix integration test
FoghostCn Jan 16, 2024
e461a39
add doc for metadata report option WithAddress
FoghostCn Jan 22, 2024
ee77794
Merge branch 'main' into refect-metadata
FoghostCn Jan 23, 2024
b0c75a5
modify README.md (#2585)
FinalT Jan 26, 2024
a134e1b
feat:add internal service extension (#2577)
FinalT Jan 26, 2024
23bdc04
Merge remote-tracking branch 'origin/main' into refect-metadata
FoghostCn Jan 29, 2024
38a1cf0
Merge branch 'main' into refect-metadata
FoghostCn Jan 29, 2024
e283246
Merge branch 'dev-3.3' into refect-metadata
FoghostCn Feb 18, 2024
da7de7f
Merge branch 'dev-3.3' into refect-metadata
chickenlj Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ metadata/report/zookeeper/zookeeper-4unittest/

# macOS
.DS_Store
.history
17 changes: 0 additions & 17 deletions client/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ func (refOpts *ReferenceOptions) refer(srv common.RPCService, info *ClientInfo)
refOpts.urls = urls
refOpts.invoker = invoker

// publish consumer's metadata
publishServiceDefinition(cfgURL)
// create proxy
if info == nil && srv != nil {
if ref.Async {
Expand Down Expand Up @@ -279,21 +277,6 @@ func buildInvoker(urls []*common.URL, ref *global.ReferenceConfig) (protocol.Inv
return resInvoker, nil
}

func publishServiceDefinition(url *common.URL) {
localService, err := extension.GetLocalMetadataService(constant.DefaultKey)
if err != nil {
logger.Warnf("get local metadata service failed, please check if you have imported _ \"dubbo.apache.org/dubbo-go/v3/metadata/service/local\"")
return
}
localService.PublishServiceDefinition(url)
if url.GetParam(constant.MetadataTypeKey, "") != constant.RemoteMetadataStorageType {
return
}
if remoteMetadataService, err := extension.GetRemoteMetadataService(); err == nil && remoteMetadataService != nil {
remoteMetadataService.PublishServiceDefinition(url)
}
}

func (refOpts *ReferenceOptions) CheckAvailable() bool {
ref := refOpts.Reference
if refOpts.invoker == nil {
Expand Down
45 changes: 45 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ package client

import (
"context"
"time"
)

import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/global"
"dubbo.apache.org/dubbo-go/v3/metadata"
"dubbo.apache.org/dubbo-go/v3/protocol"
invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
)
Expand Down Expand Up @@ -103,6 +106,9 @@ func (cli *Client) DialWithInfo(interfaceName string, info *ClientInfo, opts ...
}

func (cli *Client) dial(interfaceName string, info *ClientInfo, opts ...ReferenceOption) (*Connection, error) {
if err := cli.initRegistryMetadataReport(); err != nil {
return nil, err
}
newRefOpts := defaultReferenceOptions()
finalOpts := []ReferenceOption{
setReference(cli.cliOpts.overallReference),
Expand All @@ -122,6 +128,45 @@ func (cli *Client) dial(interfaceName string, info *ClientInfo, opts ...Referenc

return &Connection{refOpts: newRefOpts}, nil
}

func (cli *Client) initRegistryMetadataReport() error {
if len(cli.cliOpts.Registries) > 0 {
for id, reg := range cli.cliOpts.Registries {
if reg.UseAsMetaReport {
opts, err := registryToReportOptions(id, reg)
if err != nil {
return err
}
if err := opts.Init(); err != nil {
return err
}
}
}
}
return nil
}

func registryToReportOptions(id string, rc *global.RegistryConfig) (*metadata.ReportOptions, error) {
opts := metadata.NewReportOptions(
metadata.WithRegistryId(id),
metadata.WithProtocol(rc.Protocol),
metadata.WithAddress(rc.Address),
metadata.WithUsername(rc.Username),
metadata.WithPassword(rc.Password),
metadata.WithGroup(rc.Group),
metadata.WithNamespace(rc.Namespace),
metadata.WithParams(rc.Params),
)
if rc.Timeout != "" {
timeout, err := time.ParseDuration(rc.Timeout)
if err != nil {
return nil, err
}
metadata.WithTimeout(timeout)(opts)
}
return opts, nil
}

func generateInvocation(methodName string, reqs []interface{}, resp interface{}, callType string, opts *CallOptions) (protocol.Invocation, error) {
var paramsRawVals []interface{}
for _, req := range reqs {
Expand Down
2 changes: 2 additions & 0 deletions common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const (
// registry keys
const (
RegistryKey = "registry"
RegistryIdKey = "registry.id"
RegistryProtocol = "registry"
ServiceRegistryProtocol = "service-discovery-registry"
RegistryRoleKey = "registry.role"
Expand All @@ -188,6 +189,7 @@ const (

const (
ApplicationKey = "application"
ApplicationTagKey = "application.tag"
OrganizationKey = "organization"
NameKey = "name"
ModuleKey = "module"
Expand Down
51 changes: 0 additions & 51 deletions common/extension/metadata_remote.go

This file was deleted.

8 changes: 4 additions & 4 deletions common/extension/metadata_report_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
package extension

import (
"dubbo.apache.org/dubbo-go/v3/metadata/report/factory"
"dubbo.apache.org/dubbo-go/v3/metadata/report"
)

var metaDataReportFactories = make(map[string]func() factory.MetadataReportFactory, 8)
var metaDataReportFactories = make(map[string]func() report.MetadataReportFactory, 8)

// SetMetadataReportFactory sets the MetadataReportFactory with @name
func SetMetadataReportFactory(name string, v func() factory.MetadataReportFactory) {
func SetMetadataReportFactory(name string, v func() report.MetadataReportFactory) {
metaDataReportFactories[name] = v
}

// GetMetadataReportFactory finds the MetadataReportFactory with @name
func GetMetadataReportFactory(name string) factory.MetadataReportFactory {
func GetMetadataReportFactory(name string) report.MetadataReportFactory {
if metaDataReportFactories[name] == nil {
return nil
}
Expand Down
55 changes: 0 additions & 55 deletions common/extension/metadata_service.go

This file was deleted.

46 changes: 0 additions & 46 deletions common/extension/metadata_service_exporter.go

This file was deleted.

50 changes: 0 additions & 50 deletions common/extension/metadata_service_proxy_factory.go

This file was deleted.

Loading