You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2024/01/03 04:04:46 UTC

(kvrocks-website) branch json created (now 6eb2eea)

This is an automated email from the ASF dual-hosted git repository.

twice pushed a change to branch json
in repository https://gitbox.apache.org/repos/asf/kvrocks-website.git


      at 6eb2eea  Add docs for the JSON data type

This branch includes the following new commits:

     new 6eb2eea  Add docs for the JSON data type

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(kvrocks-website) 01/01: Add docs for the JSON data type

Posted by tw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch json
in repository https://gitbox.apache.org/repos/asf/kvrocks-website.git

commit 6eb2eeaaf3d32ce2307d4d77abc7b42f211c5697
Author: PragmaTwice <tw...@apache.org>
AuthorDate: Wed Jan 3 10:48:58 2024 +0800

    Add docs for the JSON data type
---
 community/data-structure-on-rocksdb.md | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/community/data-structure-on-rocksdb.md b/community/data-structure-on-rocksdb.md
index 306172f..34b2132 100644
--- a/community/data-structure-on-rocksdb.md
+++ b/community/data-structure-on-rocksdb.md
@@ -42,8 +42,10 @@ The values encoded for other data types in flags can be found in the table below
 | Set        |          4 |
 | ZSet       |          5 |
 | Bitmap     |          6 |
-| Sortedint  |          7 |
+| SortedInt  |          7 |
 | Stream     |          8 |
+| BloomFilter|          9 |
+| JSON       |         10 |
 
 In the encoding version `0`, `expire` is stored in seconds and as a 4byte field (32bit integer), `size` is stored as also a 4byte field (32bit integer);
 while in the encoding version `1`, `expire` is stored in milliseconds and as a 8byte field (64bit integer), `size` is stored as also a 8byte field (64bit integer).
@@ -289,3 +291,24 @@ key|index => |    filter     |
              +---------------+
 ```
 
+## JSON
+
+Kvrocks supports the JSON data type just like [RedisJSON](https://redis.io/docs/data-types/json/), which implements various data operations on [ECMA-404 The JSON Data Interchange Standard](https://ecma-international.org/publications-and-standards/standards/ecma-404/).
+
+The current underlying encoding of JSON data type is relatively simple and similar to String:
+
+```
+        +----------+------------+-----------+--------------------+
+key =>  |  flags   |  expire    |  format   |       payload      |
+        | (1byte)  | (Ebyte)    |  (1byte)  |       (Nbyte)      |
+        +----------+------------+-----------+--------------------+
+```
+
+where the `payload` is a string encoded in the corresponding `format`:
+
+| format     | enum value |
+|------------|------------|
+| JSON       |          0 |
+| CBOR       |          1 |
+
+Also, if we decide to add a more IO-friendly format to avoid read all payload to the memory before searching an element via JSONPath or seperate a relatively large JSON to multiple key-values, we can take advantage of the `format` field.