PragmaTwice commented on code in PR #1841:
URL: https://github.com/apache/kvrocks/pull/1841#discussion_r1379799420


##########
src/types/redis_json.cc:
##########
@@ -201,4 +201,63 @@ rocksdb::Status Json::ArrLen(const std::string &user_key, 
const std::string &pat
 
   return rocksdb::Status::OK();
 }
+
+rocksdb::Status Json::StrAppend(const std::string &user_key, const std::string 
&path, const std::string &value,
+                                std::vector<uint64_t> &append_cnt) {
+  auto ns_key = AppendNamespacePrefix(user_key);
+
+  LockGuard guard(storage_->GetLockManager(), ns_key);
+
+  std::string bytes;
+  JsonMetadata metadata;
+  Slice rest;
+  auto s = GetMetadata(kRedisJson, ns_key, &bytes, &metadata, &rest);
+  if (!s.ok()) return s;
+
+  if (metadata.format != JsonStorageFormat::JSON)
+    return rocksdb::Status::NotSupported("JSON storage format not supported");
+
+  auto json_res = JsonValue::FromString(rest.ToStringView());
+  if (!json_res) return rocksdb::Status::Corruption(json_res.Msg());
+  auto json_val = *std::move(json_res);

Review Comment:
   Could you use `read` methods instead these code? You can refer to other 
method for how to use `read`.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to