MCPcopy Create free account
hub / github.com/apache/kvrocks / DebugMemory

Method DebugMemory

src/types/redis_json.cc:642–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640}
641
642rocksdb::Status Json::DebugMemory(engine::Context &ctx, const std::string &user_key, const std::string &path,
643 std::vector<size_t> *results) {
644 auto ns_key = AppendNamespacePrefix(user_key);
645 JsonMetadata metadata;
646 if (path == "$") {
647 std::string bytes;
648 Slice rest;
649 auto s = GetMetadata(ctx, {kRedisJson}, ns_key, &bytes, &metadata, &rest);
650 if (!s.ok()) return s;
651 results->emplace_back(rest.size());
652 } else {
653 JsonValue json_val;
654 auto s = read(ctx, ns_key, &metadata, &json_val);
655 if (!s.ok()) return s;
656 auto str_bytes = json_val.GetBytes(path, metadata.format, storage_->GetConfig()->json_max_nesting_depth);
657 if (!str_bytes) return rocksdb::Status::InvalidArgument(str_bytes.Msg());
658 *results = std::move(*str_bytes);
659 }
660 return rocksdb::Status::OK();
661}
662
663rocksdb::Status Json::Resp(engine::Context &ctx, const std::string &user_key, const std::string &path,
664 std::vector<std::string> *results, RESP resp) {

Callers 1

ExecuteMethod · 0.80

Calls 3

GetBytesMethod · 0.80
GetConfigMethod · 0.45
MsgMethod · 0.45

Tested by

no test coverage detected