MasterKenway commented on a change in pull request #302:
URL: https://github.com/apache/dubbo-go-pixiu/pull/302#discussion_r753795822
##########
File path: pkg/adapter/dubboregistry/registry/registry.go
##########
@@ -75,9 +77,18 @@ func GetRegistry(name string, regConfig model.Registry,
listener common2.Registr
}
// CreateAPIConfig returns router.API struct base on the input
-func CreateAPIConfig(urlPattern string, dboBackendConfig
config.DubboBackendConfig, methodString string, mappingParams
[]config.MappingParam) router.API {
+func CreateAPIConfig(urlPattern, location string, dboBackendConfig
config.DubboBackendConfig, methodString string, mappingParams
[]config.MappingParam) router.API {
dboBackendConfig.Method = methodString
Review comment:
What is the purpose for the input param named `location`?
##########
File path: pkg/client/triple/triple.go
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+
+import (
+ "context"
+ "io/ioutil"
+ "net/url"
+ "strings"
+ "sync"
+)
+
+import (
+ proxymeta "github.com/mercari/grpc-http-proxy/metadata"
+ "github.com/mercari/grpc-http-proxy/proxy"
+)
+
+import (
+ "github.com/apache/dubbo-go-pixiu/pkg/client"
+)
+
+// InitDefaultTripleClient init default dubbo client
+func InitDefaultTripleClient() {
+ tripleClient = NewTripleClient()
+}
+
+var tripleClient *Client
+var clientOnc sync.Once
+
+// NewTripleClient create dubbo client
+func NewTripleClient() *Client {
+ clientOnc.Do(func() {
+ tripleClient = &Client{}
+ })
+ return tripleClient
+}
+
+// Client client to generic invoke dubbo
+type Client struct {
+}
+
+func (tc *Client) Apply() error {
+ panic("implement me")
+}
+
+func (tc *Client) MapParams(req *client.Request) (reqData interface{}, err
error) {
+ panic("implement me")
+}
+
+// Close clear GenericServicePool.
+func (dc *Client) Close() error {
+ return nil
+}
+
+// SingletonTripleClient singleton dubbo clent
+func SingletonTripleClient() *Client {
+ return NewTripleClient()
+}
+
+// Call invoke service
+func (dc *Client) Call(req *client.Request) (res interface{}, err error) {
+ address :=
strings.Split(req.API.IntegrationRequest.HTTPBackendConfig.URL, ":")
+ p := proxy.NewProxy()
+ targetURL := &url.URL{
+ Scheme: address[0],
+ Opaque: address[1],
+ }
+ if err := p.Connect(context.Background(), targetURL); err != nil {
+ panic(err)
+ }
+ meta := make(map[string][]string)
+ reqData, _ := ioutil.ReadAll(req.IngressRequest.Body)
+ call, err := p.Call(context.Background(),
req.API.Method.IntegrationRequest.Interface,
req.API.Method.IntegrationRequest.Method, reqData, (*proxymeta.Metadata)(&meta))
+ if err != nil {
+ panic(err)
+ }
Review comment:
panic here?
##########
File path: pkg/config/api_config.go
##########
@@ -27,8 +27,11 @@ import (
import (
fc "github.com/dubbogo/dubbo-go-pixiu-filter/pkg/api/config"
+
etcdv3 "github.com/dubbogo/gost/database/kv/etcd/v3"
+
perrors "github.com/pkg/errors"
+
"go.etcd.io/etcd/api/v3/mvccpb"
)
Review comment:
Those blank line kind of strange, isn't it ?
##########
File path: pkg/server/api_config_manager.go
##########
@@ -22,13 +22,14 @@ import (
)
import (
+ "github.com/dubbogo/dubbo-go-pixiu-filter/pkg/api/config"
+ "github.com/dubbogo/dubbo-go-pixiu-filter/pkg/router"
+
"github.com/pkg/errors"
)
import (
"github.com/apache/dubbo-go-pixiu/pkg/model"
- "github.com/dubbogo/dubbo-go-pixiu-filter/pkg/api/config"
- "github.com/dubbogo/dubbo-go-pixiu-filter/pkg/router"
)
Review comment:
Imports here is not correct as well
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]