little-cui commented on a change in pull request #220: SC-49 Pact broker module 
for consumer-driven contract testing
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/220#discussion_r170405906
 
 

 ##########
 File path: server/broker/store.go
 ##########
 @@ -0,0 +1,167 @@
+//Copyright 2017 Huawei Technologies Co., Ltd
+//
+//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 broker
+
+import (
+       "sync"
+
+       "github.com/ServiceComb/service-center/pkg/async"
+       "github.com/ServiceComb/service-center/pkg/util"
+       sstore "github.com/ServiceComb/service-center/server/core/backend/store"
+       pb "github.com/ServiceComb/service-center/server/core/proto"
+)
+
+const (
+       PARTICIPANT sstore.StoreType = iota
+       VERSION
+       PACT
+       PACT_VERSION
+       PACT_TAG
+       VERIFICATION
+       PACT_LATEST
+       typeEnd
+)
+
+var TypeNames = []string{
+       PARTICIPANT:  "PARTICIPANT",
+       VERSION:      "VERSION",
+       PACT:         "PACT",
+       PACT_VERSION: "PACT_VERSION",
+       PACT_TAG:     "PACT_TAG",
+       VERIFICATION: "VERIFICATION",
+       PACT_LATEST:  "PACT_LATEST",
+}
+
+var TypeRoots = map[sstore.StoreType]string{
+       PARTICIPANT:  GetBrokerParticipantKey(""),
+       VERSION:      GetBrokerVersionKey(""),
+       PACT:         GetBrokerPactKey(""),
+       PACT_VERSION: GetBrokerPactVersionKey(""),
+       PACT_TAG:     GetBrokerTagKey(""),
+       VERIFICATION: GetBrokerVerificationKey(""),
+       PACT_LATEST:  GetBrokerLatestKey(""),
+}
+
+var store = &BKvStore{}
+
+func Store() *BKvStore {
+       return store
+}
+
+func (s *BKvStore) StoreSize(t sstore.StoreType) int {
+       return 100
+}
+
+func (s *BKvStore) dispatchEvent(t sstore.StoreType, evt *sstore.KvEvent) {
+       s.bindexers[t].OnCacheEvent(evt)
+       select {
+       case <-s.Ready():
+       default:
+               if evt.Action == pb.EVT_CREATE {
+                       evt.Action = pb.EVT_INIT
+               }
+       }
+       sstore.EventProxy(t).OnEvent(evt)
 
 Review comment:
   please remove lines 71 to 78.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to