You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "DMwangnima (via GitHub)" <gi...@apache.org> on 2023/08/02 01:45:28 UTC
[GitHub] [dubbo-go] DMwangnima opened a new pull request, #2368: Triple adaptation and refactor demo
DMwangnima opened a new pull request, #2368:
URL: https://github.com/apache/dubbo-go/pull/2368
This PR introduces new Triple protocol based on Connect library without generic and Triple adaptation.
Main change could be seen in /consumer, /provider and /protocol/triple.
This is a POC.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] chickenlj commented on pull request #2368: Triple adaptation and refactor demo
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1670553286
Please run go fmt to fix the code format issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] chickenlj commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1287860318
##########
client/options.go:
##########
@@ -0,0 +1,352 @@
+package client
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "fmt"
+ "github.com/go-playground/validator/v10"
+ perrors "github.com/pkg/errors"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+type CallOptions struct {
+ RequestTimeout string
+ Retries string
+}
Review Comment:
The options exposed here should be further investigated to make sure it's a 100% copy of the `config` package in regard of functionality.
##########
client/client.go:
##########
@@ -0,0 +1,161 @@
+package client
+
+import (
+ "context"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/config"
+ "dubbo.apache.org/dubbo-go/v3/protocol"
+ invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
+ "github.com/pkg/errors"
+)
+
+type Client struct {
+ invoker protocol.Invoker
+ info *ClientInfo
+ cfg *ReferenceConfig
+}
+
+type ClientInfo struct {
+ InterfaceName string
+ MethodNames []string
+ ClientInjectFunc func(dubboCliRaw interface{}, cli *Client)
+ Meta map[string]interface{}
+}
+
+func (cli *Client) call(ctx context.Context, paramsRawVals []interface{}, interfaceName, methodName, callType string, opts ...CallOption) (protocol.Result, error) {
+ // get a default CallOptions
+ // apply CallOption
+ options := newDefaultCallOptions()
+ for _, opt := range opts {
+ opt(options)
+ }
+
+ inv, err := generateInvocation(methodName, paramsRawVals, callType, options)
+ if err != nil {
+ return nil, err
+ }
+ // todo: move timeout into context or invocation
+ return cli.invoker.Invoke(ctx, inv), nil
+
+}
+
+func (cli *Client) CallUnary(ctx context.Context, req, resp interface{}, interfaceName, methodName string, opts ...CallOption) error {
+ res, err := cli.call(ctx, []interface{}{req, resp}, interfaceName, methodName, constant.CallUnary, opts...)
+ if err != nil {
+ return err
+ }
+ return res.Error()
+}
+
+func (cli *Client) CallClientStream(ctx context.Context, interfaceName, methodName string, opts ...CallOption) (interface{}, error) {
+ res, err := cli.call(ctx, nil, interfaceName, methodName, constant.CallClientStream, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return res.Result(), res.Error()
+}
+
+func (cli *Client) CallServerStream(ctx context.Context, req interface{}, interfaceName, methodName string, opts ...CallOption) (interface{}, error) {
+ res, err := cli.call(ctx, []interface{}{req}, interfaceName, methodName, constant.CallServerStream, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return res.Result(), res.Error()
+}
+
+func (cli *Client) CallBidiStream(ctx context.Context, interfaceName, methodName string, opts ...CallOption) (interface{}, error) {
+ res, err := cli.call(ctx, nil, interfaceName, methodName, constant.CallBidiStream, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return res.Result(), res.Error()
+}
+
+func (cli *Client) Init(info *ClientInfo) error {
+ if info == nil {
+ return errors.New("ClientInfo is nil")
+ }
+ cli.cfg.ReferWithInfo(info)
+ cli.invoker = cli.cfg.invoker
+
+ return nil
+}
+
+func generateInvocation(methodName string, paramsRawVals []interface{}, callType string, opts *CallOptions) (protocol.Invocation, error) {
+ inv := invocation_impl.NewRPCInvocationWithOptions(
+ invocation_impl.WithMethodName(methodName),
+ // todo: process opts
+ invocation_impl.WithParameterRawValues(paramsRawVals),
+ )
+ inv.SetAttribute(constant.CallTypeKey, callType)
+
+ return inv, nil
+}
+
+func NewClient(opts ...ReferenceOption) (*Client, error) {
+ // get default RootConfigs
+ rootCfg := config.NewRootConfigBuilder().Build()
+ rootCfg.Init()
+ newRefCfg := &ReferenceConfig{}
+ for _, opt := range opts {
+ opt(newRefCfg)
+ }
+ if err := newRefCfg.Init(rootCfg); err != nil {
+ return nil, err
+ }
+ return &Client{
+ cfg: newRefCfg,
+ }, nil
+}
+
+// NewClientWithReferenceBase is used by /config/consumer_config, it assumes that refCfg has been init
+func NewClientWithReferenceBase(refCfg *ReferenceConfig, opts ...ReferenceOption) (*Client, error) {
+ if refCfg == nil {
+ return nil, errors.New("ReferenceConfig is nil")
+ }
+ for _, opt := range opts {
+ opt(refCfg)
+ }
+ return &Client{
+ cfg: refCfg,
+ }, nil
+}
+
+func NewConsumerConfig(opts ...ConsumerOption) (*ConsumerConfig, error) {
Review Comment:
I think it's better to expose only `NewClientXxx` varies in this package to users. Move `NewConsumerConfig` and `NewMethodConfig` to a new place or the previous place where it is from.
##########
protocol/triple/internal/client/cmd/main.go:
##########
@@ -0,0 +1,115 @@
+package main
+
+import (
+ "context"
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/greettriple"
+ "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+ //client initialization
+ cli, err := client.NewClient(
+ client.WithURL("127.0.0.1:8080"),
+ )
+ dubboCli, err := greettriple.NewGreetServiceClient(cli)
Review Comment:
Will `GreetService` be better than `GreetServiceClient`?
##########
protocol/triple/internal/client/cmd/main.go:
##########
@@ -0,0 +1,115 @@
+package main
+
+import (
+ "context"
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/greettriple"
+ "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+ //client initialization
+ cli, err := client.NewClient(
Review Comment:
Is `dubbogo.yml` still needed to run with this API?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1669135170
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1669133900
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1669339638
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1673333468
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] chickenlj merged pull request #2368: Triple adaptation and refactor demo
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj merged PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] DMwangnima commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "DMwangnima (via GitHub)" <gi...@apache.org>.
DMwangnima commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1288362154
##########
protocol/triple/internal/client/cmd/main.go:
##########
@@ -0,0 +1,115 @@
+package main
+
+import (
+ "context"
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/greettriple"
+ "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+ //client initialization
+ cli, err := client.NewClient(
+ client.WithURL("127.0.0.1:8080"),
+ )
+ dubboCli, err := greettriple.NewGreetServiceClient(cli)
Review Comment:
Yes, NewGreetService would be better than NewGreetServiceClient cause two client concepts create confusion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1661359901
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1673293690
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1673470778
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1673322054
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] chickenlj commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1287863715
##########
protocol/triple/internal/proto/greettriple/greet.triple.go:
##########
@@ -0,0 +1,385 @@
+// Code generated by protoc-gen-triple. DO NOT EDIT.
+//
+// Source: protocol/triple/internal/proto/greet.proto
+
+package greettriple
+
+import (
+ context "context"
+ client "dubbo.apache.org/dubbo-go/v3/client"
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/config"
+ proto "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ triple_protocol "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+ "dubbo.apache.org/dubbo-go/v3/provider"
+ errors "errors"
+ http "net/http"
+)
+
+// This is a compile-time assertion to ensure that this generated file and the connect package are
+// compatible. If you get a compiler error that this constant is not defined, this code was
+// generated with a version of connect newer than the one compiled into your binary. You can fix the
+// problem by either regenerating this code with an older version of connect or updating the connect
+// version compiled into your binary.
+const _ = triple_protocol.IsAtLeastVersion0_1_0
+
+const (
+ // GreetServiceName is the fully-qualified name of the GreetService service.
+ GreetServiceName = "greet.GreetService"
+)
+
+// These constants are the fully-qualified names of the RPCs defined in this package. They're
+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
+//
+// Note that these are different from the fully-qualified method names used by
+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
+// period.
+const (
+ // GreetServiceGreetProcedure is the fully-qualified name of the GreetService's Greet RPC.
+ GreetServiceGreetProcedure = "/greet.GreetService/Greet"
+ // GreetServiceGreetStreamProcedure is the fully-qualified name of the GreetService's GreetStream
+ // RPC.
+ GreetServiceGreetStreamProcedure = "/greet.GreetService/GreetStream"
+ // GreetServiceGreetClientStreamProcedure is the fully-qualified name of the GreetService's
+ // GreetClientStream RPC.
+ GreetServiceGreetClientStreamProcedure = "/greet.GreetService/GreetClientStream"
+ // GreetServiceGreetServerStreamProcedure is the fully-qualified name of the GreetService's
+ // GreetServerStream RPC.
+ GreetServiceGreetServerStreamProcedure = "/greet.GreetService/GreetServerStream"
+)
+
+// GreetServiceClient is a client for the greet.GreetService service.
+type GreetServiceClient interface {
+ Greet(ctx context.Context, req *proto.GreetRequest, opts ...client.CallOption) (*proto.GreetResponse, error)
+ GreetStream(ctx context.Context, opts ...client.CallOption) (GreetService_GreetStreamClient, error)
+ GreetClientStream(ctx context.Context, opts ...client.CallOption) (GreetService_GreetClientStreamClient, error)
+ GreetServerStream(ctx context.Context, req *proto.GreetServerStreamRequest, opts ...client.CallOption) (GreetService_GreetServerStreamClient, error)
+}
+
+// NewGreetServiceClient constructs a client for the greet.GreetService service. By default, it uses
+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
+// connect.WithGRPCWeb() options.
+//
+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
+// http://api.acme.com or https://acme.com/grpc).
+func NewGreetServiceClient(cli *client.Client) (GreetServiceClient, error) {
+ if err := cli.Init(&GreetService_ClientInfo); err != nil {
+ return nil, err
+ }
+ return &GreetServiceClientImpl{
+ cli: cli,
+ }, nil
+}
+
+func SetConsumerService(srv common.RPCService) {
+ config.SetClientInfoService(&GreetService_ClientInfo, srv)
+}
Review Comment:
How about we remove all the unnecessary old code stubs from the generated file?
For users who rely on old stubs, they can still use the old compiler to generate the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] github-code-scanning[bot] commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1281301124
##########
protocol/triple/triple_protocol/code.go:
##########
@@ -0,0 +1,226 @@
+// Copyright 2021-2023 Buf Technologies, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package triple_protocol
+
+import (
+ "fmt"
+ "strconv"
+ "strings"
+)
+
+// A Code is one of the Connect protocol's error codes. There are no user-defined
+// codes, so only the codes enumerated below are valid. In both name and
+// semantics, these codes match the gRPC status codes.
+//
+// The descriptions below are optimized for brevity rather than completeness.
+// See the [Connect protocol specification] for detailed descriptions of each
+// code and example usage.
+//
+// [Connect protocol specification]: https://connect.build/docs/protocol
+type Code uint32
+
+const (
+ // The zero code in gRPC is OK, which indicates that the operation was a
+ // success. We don't define a constant for it because it overlaps awkwardly
+ // with Go's error semantics: what does it mean to have a non-nil error with
+ // an OK status? (Also, the Connect protocol doesn't use a code for
+ // successes.)
+
+ // CodeCanceled indicates that the operation was canceled, typically by the
+ // caller.
+ CodeCanceled Code = 1
+
+ // CodeUnknown indicates that the operation failed for an unknown reason.
+ CodeUnknown Code = 2
+
+ // CodeInvalidArgument indicates that client supplied an invalid argument.
+ CodeInvalidArgument Code = 3
+
+ // CodeDeadlineExceeded indicates that deadline expired before the operation
+ // could complete.
+ CodeDeadlineExceeded Code = 4
+
+ // CodeNotFound indicates that some requested entity (for example, a file or
+ // directory) was not found.
+ CodeNotFound Code = 5
+
+ // CodeAlreadyExists indicates that client attempted to create an entity (for
+ // example, a file or directory) that already exists.
+ CodeAlreadyExists Code = 6
+
+ // CodePermissionDenied indicates that the caller doesn't have permission to
+ // execute the specified operation.
+ CodePermissionDenied Code = 7
+
+ // CodeResourceExhausted indicates that some resource has been exhausted. For
+ // example, a per-user quota may be exhausted or the entire file system may
+ // be full.
+ CodeResourceExhausted Code = 8
+
+ // CodeFailedPrecondition indicates that the system is not in a state
+ // required for the operation's execution.
+ CodeFailedPrecondition Code = 9
+
+ // CodeAborted indicates that operation was aborted by the system, usually
+ // because of a concurrency issue such as a sequencer check failure or
+ // transaction abort.
+ CodeAborted Code = 10
+
+ // CodeOutOfRange indicates that the operation was attempted past the valid
+ // range (for example, seeking past end-of-file).
+ CodeOutOfRange Code = 11
+
+ // CodeUnimplemented indicates that the operation isn't implemented,
+ // supported, or enabled in this service.
+ CodeUnimplemented Code = 12
+
+ // CodeInternal indicates that some invariants expected by the underlying
+ // system have been broken. This code is reserved for serious errors.
+ CodeInternal Code = 13
+
+ // CodeUnavailable indicates that the service is currently unavailable. This
+ // is usually temporary, so clients can back off and retry idempotent
+ // operations.
+ CodeUnavailable Code = 14
+
+ // CodeDataLoss indicates that the operation has resulted in unrecoverable
+ // data loss or corruption.
+ CodeDataLoss Code = 15
+
+ // CodeUnauthenticated indicates that the request does not have valid
+ // authentication credentials for the operation.
+ CodeUnauthenticated Code = 16
+
+ minCode = CodeCanceled
+ maxCode = CodeUnauthenticated
+)
+
+func (c Code) String() string {
+ switch c {
+ case CodeCanceled:
+ return "canceled"
+ case CodeUnknown:
+ return "unknown"
+ case CodeInvalidArgument:
+ return "invalid_argument"
+ case CodeDeadlineExceeded:
+ return "deadline_exceeded"
+ case CodeNotFound:
+ return "not_found"
+ case CodeAlreadyExists:
+ return "already_exists"
+ case CodePermissionDenied:
+ return "permission_denied"
+ case CodeResourceExhausted:
+ return "resource_exhausted"
+ case CodeFailedPrecondition:
+ return "failed_precondition"
+ case CodeAborted:
+ return "aborted"
+ case CodeOutOfRange:
+ return "out_of_range"
+ case CodeUnimplemented:
+ return "unimplemented"
+ case CodeInternal:
+ return "internal"
+ case CodeUnavailable:
+ return "unavailable"
+ case CodeDataLoss:
+ return "data_loss"
+ case CodeUnauthenticated:
+ return "unauthenticated"
+ }
+ return fmt.Sprintf("code_%d", c)
+}
+
+// MarshalText implements [encoding.TextMarshaler].
+func (c Code) MarshalText() ([]byte, error) {
+ return []byte(c.String()), nil
+}
+
+// UnmarshalText implements [encoding.TextUnmarshaler].
+func (c *Code) UnmarshalText(data []byte) error {
+ dataStr := string(data)
+ switch dataStr {
+ case "canceled":
+ *c = CodeCanceled
+ return nil
+ case "unknown":
+ *c = CodeUnknown
+ return nil
+ case "invalid_argument":
+ *c = CodeInvalidArgument
+ return nil
+ case "deadline_exceeded":
+ *c = CodeDeadlineExceeded
+ return nil
+ case "not_found":
+ *c = CodeNotFound
+ return nil
+ case "already_exists":
+ *c = CodeAlreadyExists
+ return nil
+ case "permission_denied":
+ *c = CodePermissionDenied
+ return nil
+ case "resource_exhausted":
+ *c = CodeResourceExhausted
+ return nil
+ case "failed_precondition":
+ *c = CodeFailedPrecondition
+ return nil
+ case "aborted":
+ *c = CodeAborted
+ return nil
+ case "out_of_range":
+ *c = CodeOutOfRange
+ return nil
+ case "unimplemented":
+ *c = CodeUnimplemented
+ return nil
+ case "internal":
+ *c = CodeInternal
+ return nil
+ case "unavailable":
+ *c = CodeUnavailable
+ return nil
+ case "data_loss":
+ *c = CodeDataLoss
+ return nil
+ case "unauthenticated":
+ *c = CodeUnauthenticated
+ return nil
+ }
+ // Ensure that non-canonical codes round-trip through MarshalText and
+ // UnmarshalText.
+ if strings.HasPrefix(dataStr, "code_") {
+ 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)
Review Comment:
## Incorrect conversion between integer types
Incorrect conversion of a 64-bit integer from [strconv.ParseInt](1) to a lower bit size type uint32 without an upper bound check.
[Show more details](https://github.com/apache/dubbo-go/security/code-scanning/21)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] DMwangnima commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "DMwangnima (via GitHub)" <gi...@apache.org>.
DMwangnima commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1288364189
##########
protocol/triple/internal/client/cmd/main.go:
##########
@@ -0,0 +1,115 @@
+package main
+
+import (
+ "context"
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/greettriple"
+ "github.com/dubbogo/gost/log/logger"
+)
+
+func main() {
+ //client initialization
+ cli, err := client.NewClient(
Review Comment:
No, dubbogo.yml is only needed for classic configuration (SetConsumerService, config.Load). In this case, just create client with options.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] DMwangnima commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "DMwangnima (via GitHub)" <gi...@apache.org>.
DMwangnima commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1288375078
##########
protocol/triple/internal/proto/greettriple/greet.triple.go:
##########
@@ -0,0 +1,385 @@
+// Code generated by protoc-gen-triple. DO NOT EDIT.
+//
+// Source: protocol/triple/internal/proto/greet.proto
+
+package greettriple
+
+import (
+ context "context"
+ client "dubbo.apache.org/dubbo-go/v3/client"
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/config"
+ proto "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
+ triple_protocol "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+ "dubbo.apache.org/dubbo-go/v3/provider"
+ errors "errors"
+ http "net/http"
+)
+
+// This is a compile-time assertion to ensure that this generated file and the connect package are
+// compatible. If you get a compiler error that this constant is not defined, this code was
+// generated with a version of connect newer than the one compiled into your binary. You can fix the
+// problem by either regenerating this code with an older version of connect or updating the connect
+// version compiled into your binary.
+const _ = triple_protocol.IsAtLeastVersion0_1_0
+
+const (
+ // GreetServiceName is the fully-qualified name of the GreetService service.
+ GreetServiceName = "greet.GreetService"
+)
+
+// These constants are the fully-qualified names of the RPCs defined in this package. They're
+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
+//
+// Note that these are different from the fully-qualified method names used by
+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
+// period.
+const (
+ // GreetServiceGreetProcedure is the fully-qualified name of the GreetService's Greet RPC.
+ GreetServiceGreetProcedure = "/greet.GreetService/Greet"
+ // GreetServiceGreetStreamProcedure is the fully-qualified name of the GreetService's GreetStream
+ // RPC.
+ GreetServiceGreetStreamProcedure = "/greet.GreetService/GreetStream"
+ // GreetServiceGreetClientStreamProcedure is the fully-qualified name of the GreetService's
+ // GreetClientStream RPC.
+ GreetServiceGreetClientStreamProcedure = "/greet.GreetService/GreetClientStream"
+ // GreetServiceGreetServerStreamProcedure is the fully-qualified name of the GreetService's
+ // GreetServerStream RPC.
+ GreetServiceGreetServerStreamProcedure = "/greet.GreetService/GreetServerStream"
+)
+
+// GreetServiceClient is a client for the greet.GreetService service.
+type GreetServiceClient interface {
+ Greet(ctx context.Context, req *proto.GreetRequest, opts ...client.CallOption) (*proto.GreetResponse, error)
+ GreetStream(ctx context.Context, opts ...client.CallOption) (GreetService_GreetStreamClient, error)
+ GreetClientStream(ctx context.Context, opts ...client.CallOption) (GreetService_GreetClientStreamClient, error)
+ GreetServerStream(ctx context.Context, req *proto.GreetServerStreamRequest, opts ...client.CallOption) (GreetService_GreetServerStreamClient, error)
+}
+
+// NewGreetServiceClient constructs a client for the greet.GreetService service. By default, it uses
+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
+// connect.WithGRPCWeb() options.
+//
+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
+// http://api.acme.com or https://acme.com/grpc).
+func NewGreetServiceClient(cli *client.Client) (GreetServiceClient, error) {
+ if err := cli.Init(&GreetService_ClientInfo); err != nil {
+ return nil, err
+ }
+ return &GreetServiceClientImpl{
+ cli: cli,
+ }, nil
+}
+
+func SetConsumerService(srv common.RPCService) {
+ config.SetClientInfoService(&GreetService_ClientInfo, srv)
+}
Review Comment:
The code generated by old compiler still depends on grpc library. Maybe there is a scenario that user wants to upgrade all services with new compiler? In this case, user also needs a classical config loading way to solve the complex configuration problem.(Assume that we have not provided NewClient with dubbogo.yml)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] DMwangnima commented on a diff in pull request #2368: Triple adaptation and refactor demo
Posted by "DMwangnima (via GitHub)" <gi...@apache.org>.
DMwangnima commented on code in PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#discussion_r1288378918
##########
client/options.go:
##########
@@ -0,0 +1,352 @@
+package client
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "fmt"
+ "github.com/go-playground/validator/v10"
+ perrors "github.com/pkg/errors"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+type CallOptions struct {
+ RequestTimeout string
+ Retries string
+}
Review Comment:
Yes, It's a placeholder that waits for professionals to think about what fields should be exposed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] sonarcloud[bot] commented on pull request #2368: Triple adaptation and refactor demo
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2368:
URL: https://github.com/apache/dubbo-go/pull/2368#issuecomment-1673319315
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2368)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2368&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2368&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org