-
Notifications
You must be signed in to change notification settings - Fork 929
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
Triple refactor demo #2341
Triple refactor demo #2341
Conversation
imports/imports.go
Outdated
@@ -70,6 +70,7 @@ import ( | |||
_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health" | |||
_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/reflection" | |||
_ "dubbo.apache.org/dubbo-go/v3/protocol/grpc" | |||
_ "dubbo.apache.org/dubbo-go/v3/protocol/grpc_new" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should be determined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used grpc_new to represent new protocol temporarily. The exact name will be determined later.
protocol/grpc_new/client.go
Outdated
func NewClient(url *common.URL) (*Client, error) { | ||
// If global trace instance was set, it means trace function enabled. | ||
// If not, will return NoopTracer. | ||
//tracer := opentracing.GlobalTracer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If global trace instance was set, it means trace function enabled.
// If not, it will return NoopTracer.
// tracer := opentracing.GlobalTracer()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to think about how to use Middleware mode to add tracer.
protocol/grpc_new/client.go
Outdated
conRefs := config.GetConsumerConfig().References | ||
ref, ok := conRefs[key] | ||
if !ok { | ||
panic("no reference") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please print all references for debugging proposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/client.go
Outdated
cliOpts = append(cliOpts, connect.WithGRPC()) | ||
// todo: process triple | ||
default: | ||
panic("not support") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic("not support") | |
panic("%s is not supported", ref.Protocol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/client.go
Outdated
} | ||
} | ||
cliOpts = append(cliOpts, connect.WithGRPC()) | ||
// todo: process triple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the GPRC_NEW replace the Triple protocol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on how the composition of the triple protocol is identified. Maybe Rest(?)+GRPC ?
protocol/grpc_new/client.go
Outdated
ref, ok := conRefs[key] | ||
if !ok { | ||
panic("no reference") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ref, ok := conRefs[key]; !ok {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/client.go
Outdated
return nil, err | ||
} | ||
tlsFlag = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if tlsConfig := config.GetRootConfig().TLSConfig; tlsConfig != nil {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/client.go
Outdated
|
||
key := url.GetParam(constant.InterfaceKey, "") | ||
impl := config.GetConsumerServiceByInterfaceName(key) | ||
conRefs := config.GetConsumerConfig().References |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var (
key = url.GetParam(constant.InterfaceKey, "")
impl = config.GetConsumerServiceByInterfaceName(key)
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/client.go
Outdated
default: | ||
panic("not support") | ||
} | ||
cli := &http.Client{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli := &http.Client{ | |
client := &http.Client{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
protocol/grpc_new/server.go
Outdated
//) | ||
var cfg *tls.Config | ||
tlsConfig := config.GetRootConfig().TLSConfig | ||
if tlsConfig != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Plus, this pull request can be splited into three commits:
|
Kudos, SonarCloud Quality Gate passed! |
protocol/grpc_new/triple/code.go
Outdated
dataStr = strings.TrimPrefix(dataStr, "code_") | ||
code, err := strconv.ParseInt(dataStr, 10 /* base */, 64 /* bitsize */) | ||
if err == nil && (code < int64(minCode) || code > int64(maxCode)) { | ||
*c = Code(code) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types
2af5a07
to
cf92f8c
Compare
Kudos, SonarCloud Quality Gate passed! |
Core code
See /protocol/grpc_new
How to use protoc-gen-connect-go
Compile /protocol/grpc_new/protoc-gen-connect with name grpc-gen-connect-go, then move this file to GOPATH eg: /usr/local/go/bin. Then, execute this command in dubbo-go dir.
protoc --go_out=. --connect-go_out=. --go_opt=paths=source_relative --connect-go_opt=paths=source_relative ./protocol/grpc_new/connect/proto/connect/ping/v1/ping.proto
user demo
See /protocol/grpc_new/internal
Current progress and follow-up plans
Successfully adapted the Connect protocol to dubbo-go. Protocol details will be adjusted and cross-testing will be added in the future.