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/06/19 07:20:40 UTC

[GitHub] [servicecomb-kie] Sphairis commented on a change in pull request #185: [wip]add upload interface

Sphairis commented on a change in pull request #185:
URL: https://github.com/apache/servicecomb-kie/pull/185#discussion_r654761156



##########
File path: server/resource/v1/kv_resource.go
##########
@@ -40,6 +41,108 @@ import (
 type KVResource struct {
 }
 
+//Upload upload kvs
+func (r *KVResource) Upload(rctx *restful.Context) {
+	var err error
+	project := rctx.ReadPathParameter(common.PathParameterProject)
+	kvs := new([]*model.KVDoc)
+	if err = readRequest(rctx, kvs); err != nil {
+		WriteErrResponse(rctx, config.ErrInvalidParams, fmt.Sprintf(FmtReadRequestError, err))
+		return
+	}
+	overridden := rctx.ReadQueryParameter(common.QueryParamOverridden)
+	stopped := false
+	result := &model.DocRespOfUpload{
+		Success: []*model.KVDoc{},
+		Failure: []*model.DocFailedOfUpload{},
+	}
+	for _, kv := range *kvs {
+		if kv == nil {
+			continue
+		}
+		key := kv.Key
+		if strings.EqualFold(overridden, common.Stop) && stopped {
+			openlog.Info(fmt.Sprintf("stop create kv %s", kv.Key))
+			getFailedKV(config.ErrStopUpload, "stop overriding kvs after reaching the duplicate kv", key, result)
+			continue
+		}
+		domain := ReadDomain(rctx.Ctx)

Review comment:
       done




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