You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/11/11 02:39:32 UTC

[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #1166: user go chassis as service center grpc development framework

robotLJW commented on a change in pull request #1166:
URL: https://github.com/apache/servicecomb-service-center/pull/1166#discussion_r747150230



##########
File path: client/set.go
##########
@@ -0,0 +1,31 @@
+package client
+
+import (
+	"fmt"
+
+	v1sync "github.com/apache/servicecomb-service-center/api/sync/v1"
+	"github.com/apache/servicecomb-service-center/pkg/log"
+	"google.golang.org/grpc"
+)
+
+// SetConfig is client configs
+type SetConfig struct {
+	Addr string
+}
+
+// Set is set of grpc clients
+type Set struct {
+	EventServiceClient v1sync.EventServiceClient
+}
+
+//NewSetForConfig dial grpc connection and create all grpc clients

Review comment:
       这个注释// 后面应该空一格

##########
File path: api/sync/v1/event_service.proto
##########
@@ -0,0 +1,24 @@
+syntax = "proto3";
+package api.sync.v1;
+option go_package="github.com/apache/servicecomb-service-center/api/sync/v1;v1";
+message EventList {
+  repeated Event Events= 1;
+}
+message Event {
+  string id = 1;      //entity id
+  string action = 2;  //create, delete, update
+  string subject = 3; //a entity name such as account, role, service, instance
+  map<string, string> opts = 4; //metadata or options
+  bytes value = 5; // the entity
+  int64 epoch = 6;

Review comment:
       epoch 这个字段用于干啥

##########
File path: client/set.go
##########
@@ -0,0 +1,31 @@
+package client
+
+import (
+	"fmt"
+
+	v1sync "github.com/apache/servicecomb-service-center/api/sync/v1"
+	"github.com/apache/servicecomb-service-center/pkg/log"
+	"google.golang.org/grpc"
+)
+
+// SetConfig is client configs
+type SetConfig struct {
+	Addr string
+}
+
+// Set is set of grpc clients
+type Set struct {
+	EventServiceClient v1sync.EventServiceClient

Review comment:
       这个 set 是不是改成 xxxClient 比较合适 
   
   > type xxxClient struct {
   	addr string
   	conn *ggrpc.ClientConn
   	cli  v1sync.EventServiceClient
   }
   
   
   

##########
File path: etc/conf/app.yaml
##########
@@ -16,6 +16,22 @@
 # environment can specify the sc running env, like dev or prod
 environment: dev
 
+sync:
+  datacenter:

Review comment:
       sync 这边是不是得弄个开关。open : true

##########
File path: server/rpc/sync/sync_server.go
##########
@@ -0,0 +1,18 @@
+package sync
+

Review comment:
       sync_server.go已经在 sync 文件下面了,是不是直接 server.go 会更好

##########
File path: api/README.md
##########
@@ -0,0 +1,12 @@
+# ServiceComb gRPC API
+This go module contains all grpc service definition of service center 

Review comment:
       这边为什么抽一个模块,我的意思是 api 为什么需要单独搞一个 go mod,单独弄成一个模块,后续是想要抽出去吗?




-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org