Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add global dubbo instance conception #2406

Merged
merged 7 commits into from
Sep 1, 2023

Conversation

DMwangnima
Copy link
Contributor

This PR adds global dubbo Instance conception (Instance may be replaced by a more ideal conception).

In the former PRs, we introduced client layer mapping to config.ReferenceConfig. Then, server layer mapping to config.ServiceConfig will be introduced too. These layers can provide the basic RPC function for users. But for users who hope to inject global configurations (eg. config.ApplicationConfig) and initialize common modules needed by both client and server sides (eg. config.RegistryConfig), it is not enough.

As a result, we introduce a top layer conception Instance mapping to config.RootConfig. It is responsible for setting global configurations and common modules. Then, user-side code would changed like this:

import "dubbo.apache.org/dubbo-go/v3"

ins, err := dubbo.NewInstance()
if err != nil {
    panic(err)
}

cli, err := ins.NewClient()
if err != nil {
    panic(err)
}

// then use generated code with cli

PS. This layer also needs compatible functions like #2399.

@sonarcloud
Copy link

sonarcloud bot commented Sep 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 61 Code Smells

No Coverage information No Coverage information
1.3% 1.3% Duplication

@chickenlj
Copy link
Contributor

image

image

Copy link
Contributor

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chickenlj
Copy link
Contributor

I suggest we put all configs into one unified package - global can currently be the right place.

One principle we must always keep in mind is we need to separate 'config' from 'action', all the new configs must only include getter/setters but no functionalities.

@chickenlj chickenlj merged commit 4ceaaa9 into apache:feature-triple Sep 1, 2023
4 of 6 checks passed
@DMwangnima DMwangnima deleted the feature-triple-layer branch September 26, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants