lilai23 commented on a change in pull request #757:
URL: 
https://github.com/apache/servicecomb-service-center/pull/757#discussion_r532311791



##########
File path: cmd/syncer/conf/microservice.yaml
##########
@@ -0,0 +1,3 @@
+servicecomb:
+  service:
+    name: FullSyncronization

Review comment:
       已修改

##########
File path: syncer/server/handler.go
##########
@@ -104,3 +188,73 @@ func (s *Server) userEvent(data ...[]byte) (success bool) {
        s.servicecenter.Registry(clusterName, syncData)
        return true
 }
+
+func (s *Server) incrementUserEvent(data ...[]byte) (success bool) {
+       log.Debug("Receive serf user event")
+       clusterName := util.BytesToStringWithNoCopy(data[0])
+
+       // Excludes notifications from self, as the gossip protocol inevitably 
has redundant notifications
+       if s.conf.Cluster == clusterName {
+               return
+       }
+
+       tags := map[string]string{tagKeyClusterName: clusterName}
+       // Get member information and get synchronized data from it
+       members := s.serf.MembersByTags(tags)
+       if len(members) == 0 {
+               log.Warnf("serf member = %s is not found", clusterName)

Review comment:
       抱歉,忽略查找修改warnf了,已修改

##########
File path: syncer/server/http.go
##########
@@ -0,0 +1,44 @@
+package server
+
+import (
+       "github.com/apache/servicecomb-service-center/pkg/log"
+       "github.com/go-chassis/go-chassis/v2"
+       rf "github.com/go-chassis/go-chassis/v2/server/restful"
+       "github.com/go-chassis/openlog"
+       "net/http"
+)
+
+const (
+       Message = "Deliver full synchronization task success!"
+)
+
+func (s *Server) FullSync(b *rf.Context) {
+       s.mux.Lock()
+       s.triggered = true
+       s.mux.Unlock()
+       err := b.Write([]byte(Message))
+       if err != nil {
+               log.Error("", err)
+       }
+       return
+}
+
+func (s *Server) URLPatterns() []rf.Route {
+       return []rf.Route{
+               {Method: http.MethodGet, Path: "/v1/syncer/full_sync", 
ResourceFunc: s.FullSync},

Review comment:
       已修改/v1/syncer/full-synchronization

##########
File path: syncer/server/http.go
##########
@@ -0,0 +1,44 @@
+package server
+
+import (
+       "github.com/apache/servicecomb-service-center/pkg/log"
+       "github.com/go-chassis/go-chassis/v2"
+       rf "github.com/go-chassis/go-chassis/v2/server/restful"
+       "github.com/go-chassis/openlog"
+       "net/http"
+)
+
+const (
+       Message = "Deliver full synchronization task success!"
+)
+
+func (s *Server) FullSync(b *rf.Context) {
+       s.mux.Lock()
+       s.triggered = true
+       s.mux.Unlock()
+       err := b.Write([]byte(Message))
+       if err != nil {
+               log.Error("", err)
+       }
+       return
+}
+
+func (s *Server) URLPatterns() []rf.Route {
+       return []rf.Route{
+               {Method: http.MethodGet, Path: "/v1/syncer/full_sync", 
ResourceFunc: s.FullSync},
+       }
+}
+
+//if you use go run main.go instead of binary run, plz export 
CHASSIS_HOME=/{path}/{to}/server/
+
+func (s *Server) NewHttpServer() {
+       chassis.RegisterSchema("rest", s)
+       if err := chassis.Init(); err != nil {
+               openlog.Fatal("Init failed." + err.Error())

Review comment:
       已修改




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