tianxiaoliang commented on a change in pull request #693:
URL: 
https://github.com/apache/servicecomb-service-center/pull/693#discussion_r487768200



##########
File path: pkg/registry/registry.pb.go
##########
@@ -0,0 +1,17 @@
+package registry
+
+import (
+       "github.com/gogo/protobuf/proto"
+)

Review comment:
       是否有使用pb的必要

##########
File path: syncer/plugins/servicecenter/instance.go
##########
@@ -0,0 +1,57 @@
+/*
+ * 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 servicecenter
+
+import (
+       "context"
+       "github.com/apache/servicecomb-service-center/server/core"
+
+       pb "github.com/apache/servicecomb-service-center/syncer/proto"
+)
+
+// RegisterInstance register instance to servicecenter
+func (c *Client) RegisterInstance(ctx context.Context, domainProject, 
serviceId string, syncInstance *pb.SyncInstance) (string, error) {
+       instance := toInstance(syncInstance)
+       instance.InstanceId = ""
+       instance.ServiceId = serviceId
+       domain, project := core.FromDomainProject(domainProject)
+       instanceID, err := c.cli.RegisterInstance(ctx, domain, project, 
serviceId, instance)
+       if err != nil {
+               return "", err
+       }
+       return instanceID, nil
+}
+
+// UnregisterInstance unregister instance from servicecenter
+func (c *Client) UnregisterInstance(ctx context.Context, domainProject, 
serviceId, instanceId string) error {
+       domain, project := core.FromDomainProject(domainProject)

Review comment:
       FromDomainProject方法应该放到pkg下边,而不该是core下边,请帮忙重构下吧,syncer调sc内核,这个代码设计不好

##########
File path: syncer/plugins/servicecenter/servicecenter.go
##########
@@ -0,0 +1,85 @@
+/*
+ * 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 servicecenter
+
+import (
+       "context"
+       sc "github.com/apache/servicecomb-service-center/client"

Review comment:
       sc的client不可以继续再用了,请使用go chassis里面的sc client包

##########
File path: pkg/registry/registry.pb.go
##########
@@ -0,0 +1,17 @@
+package registry
+
+import (
+       "github.com/gogo/protobuf/proto"
+)

Review comment:
       缺少证书头

##########
File path: syncer/serf/serf.go
##########
@@ -48,10 +49,11 @@ type Server struct {
        stopCh  chan struct{}
 
        handlerMap *sync.Map
+       joinAddr   []string
 }
 
 // NewServer new serf server with options
-func NewServer(opts ...Option) *Server {
+func NewServer(join string, opts ...Option) *Server {

Review comment:
       join 名字换下,peer addresses




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to