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/04/09 12:47:48 UTC
[GitHub] [servicecomb-kie] zhulijian1 opened a new pull request #135:
support delete multiple kvs
zhulijian1 opened a new pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406603059
##########
File path: pkg/model/db_schema.go
##########
@@ -42,8 +42,8 @@ type KVDoc struct {
CreateTime int64 `json:"create_time,omitempty" bson:"create_time," yaml:"create_time,omitempty"`
UpdateTime int64 `json:"update_time,omitempty" bson:"update_time," yaml:"update_time,omitempty"`
- Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" validate:"max=64,dive,keys,commonName,endkeys,commonName"` //redundant
- Domain string `json:"domain,omitempty" yaml:"domain,omitempty" validate:"commonName"` //redundant
+ Labels map[string]string `json:"labels" yaml:"labels" validate:"max=64,dive,keys,commonName,endkeys,commonName"` //redundant
Review comment:
label应当omit,因为考虑有些人不想考虑label带来的复杂性,就当kv存储用了,又有历史版本等增值功能
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406603301
##########
File path: server/resource/v1/doc_struct.go
##########
@@ -169,6 +169,11 @@ type KVUpdateBody struct {
Value string `json:"value"`
}
+//DeleteBody is the request body struct of delete multiple kvs interface
+type DeleteBody struct {
+ IDs []string `json:"ids" yaml:"ids"`
Review comment:
不必支持yaml,之所以创建更新支持是为了用户能够使用时,更好的在命令好或者文本编辑器中能够编辑value
----------------------------------------------------------------
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 #135: support
delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406602862
##########
File path: docs/api.yaml
##########
@@ -94,6 +94,36 @@ paths:
description: ""
schema:
$ref: '#/definitions/DocResponseSingleKey'
+ delete:
+ summary: delete keys.
+ operationId: DeleteList
+ parameters:
+ - name: project
+ in: path
+ required: true
+ type: string
+ - name: Content-Type
+ in: header
+ description: used to indicate the media type of the resource, the value can
+ be application/json or text/yaml
Review comment:
不该接受yaml
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406602883
##########
File path: docs/api.yaml
##########
@@ -94,6 +94,36 @@ paths:
description: ""
schema:
$ref: '#/definitions/DocResponseSingleKey'
+ delete:
+ summary: delete keys.
+ operationId: DeleteList
+ parameters:
+ - name: project
+ in: path
+ required: true
+ type: string
+ - name: Content-Type
+ in: header
+ description: used to indicate the media type of the resource, the value can
+ be application/json or text/yaml
+ required: true
+ type: string
+ - name: body
+ in: body
+ required: true
+ schema:
+ $ref: '#/definitions/v1.DeleteBody'
+ consumes:
+ - application/json
+ - text/yaml
Review comment:
不该接受yaml
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406603694
##########
File path: server/resource/v1/kv_resource.go
##########
@@ -266,28 +266,25 @@ func (r *KVResource) Delete(rctx *restful.Context) {
WriteErrResponse(rctx, http.StatusBadRequest, err.Error())
return
}
- kv, err := service.KVService.Get(rctx.Ctx, domain, project, kvID)
- if err != nil {
- openlogging.Error("kv_resource: " + err.Error())
- if err == service.ErrKeyNotExists {
- WriteErrResponse(rctx, http.StatusNotFound, err.Error())
- return
+ kvs, err := service.KVService.FindAndDelete(rctx.Ctx, []string{kvID}, domain, project)
Review comment:
我不建议统一API,保持2种api原语用起来方便,没必要make一个slice
----------------------------------------------------------------
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 #135: support delete multiple kvs
Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #135: support delete multiple kvs
URL: https://github.com/apache/servicecomb-kie/pull/135#discussion_r406603786
##########
File path: server/resource/v1/kv_resource.go
##########
@@ -298,6 +295,48 @@ func (r *KVResource) Delete(rctx *restful.Context) {
rctx.WriteHeader(http.StatusNoContent)
}
+//DeleteList deletes multiple kvs by ids
+func (r *KVResource) DeleteList(rctx *restful.Context) {
+ project := rctx.ReadPathParameter(common.PathParameterProject)
+ domain := ReadDomain(rctx).(string)
+ db := new(DeleteBody)
Review comment:
db容易误会,叫b吧
----------------------------------------------------------------
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