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 2020/02/29 15:10:26 UTC

[GitHub] [servicecomb-kie] zhulijian1 opened a new pull request #106: increase revision counter when delete key

zhulijian1 opened a new pull request #106: increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106
 
 
   Fixes #102 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 opened a new pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
zhulijian1 opened a new pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106
 
 
   Fixes #102 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386259873
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -335,6 +345,16 @@ func (r *KVResource) Delete(context *restful.Context) {
 		WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
 		return
 	}
+	err = pubsub.Publish(&pubsub.KVChangeEvent{
+		Key:      kv.Key,
+		Labels:   kv.Labels,
+		Project:  project,
+		DomainID: domain.(string),
+		Action:   "delete",
 
 Review comment:
   fixed

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 closed pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
zhulijian1 closed pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386238429
 
 

 ##########
 File path: server/service/options.go
 ##########
 @@ -53,6 +54,13 @@ func WithExactLabels() FindOption {
 	}
 }
 
+//WithID find by key
 
 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang merged pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386239736
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -335,6 +345,16 @@ func (r *KVResource) Delete(context *restful.Context) {
 		WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
 		return
 	}
+	err = pubsub.Publish(&pubsub.KVChangeEvent{
+		Key:      kv.Key,
+		Labels:   kv.Labels,
+		Project:  project,
+		DomainID: domain.(string),
+		Action:   "delete",
 
 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386259820
 
 

 ##########
 File path: server/service/options.go
 ##########
 @@ -53,6 +54,13 @@ func WithExactLabels() FindOption {
 	}
 }
 
+//WithID find by key
 
 Review comment:
   fixed

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386245940
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -326,7 +326,17 @@ func (r *KVResource) Delete(context *restful.Context) {
 		WriteErrResponse(context, http.StatusBadRequest, common.ErrKvIDMustNotEmpty, common.ContentTypeText)
 		return
 	}
-	err := service.KVService.Delete(context.Ctx, kvID, domain.(string), project)
+	result, err := service.KVService.FindKV(context.Ctx, domain.(string), project,
+		service.WithID(kvID))
+	if err != nil && err != service.ErrKeyNotExists {
 
 Review comment:
   主要是要Publish一个事件就必须先查一下,传进来的是id,构造KVChangeEvent的时候不知道key和label。既然查都查了,没查到就返回了,我ErrKeyNotExists的错误也排除了,删除时查不到不会出错

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #106: #102 increase revision counter when delete key
URL: https://github.com/apache/servicecomb-kie/pull/106#discussion_r386239567
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -326,7 +326,17 @@ func (r *KVResource) Delete(context *restful.Context) {
 		WriteErrResponse(context, http.StatusBadRequest, common.ErrKvIDMustNotEmpty, common.ContentTypeText)
 		return
 	}
-	err := service.KVService.Delete(context.Ctx, kvID, domain.(string), project)
+	result, err := service.KVService.FindKV(context.Ctx, domain.(string), project,
+		service.WithID(kvID))
+	if err != nil && err != service.ErrKeyNotExists {
 
 Review comment:
   不必先查再删,保持API是幂等的,我觉得挺好,你怎么想

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services