json: implement json_tree class
New JSON tree class would store JSON paths for tuple fields for registered non-plain indexes. It is a hierarchical data structure that organize JSON nodes produced by parser. Class provides API to lookup node by path and iterate over the tree. JSON Indexes patch require such functionality to make lookup for tuple_fields by path, make initialization of field map and build vynyl_stmt msgpack for secondary index via JSON tree iteration. @locker: - Forbid root = NULL in json_tree_lookup_path. - Make loop variable first in foreach macros argument list. - Use int instead of uint32_t unless uint32_t is specifically required. - Set max_child_idx to -1 if children array is empty to avoid ambiguity. - Fix child index allocation for JSON_TOKEN_STR. - Rework json_tree_add and json_tree_del to make them more straightforward. - Add comments and cleanup code. Needed for #1012
Showing
- src/lib/json/CMakeLists.txt 1 addition, 0 deletionssrc/lib/json/CMakeLists.txt
- src/lib/json/json.c 276 additions, 0 deletionssrc/lib/json/json.c
- src/lib/json/json.h 334 additions, 0 deletionssrc/lib/json/json.h
- test/unit/json_path.c 241 additions, 1 deletiontest/unit/json_path.c
- test/unit/json_path.result 59 additions, 1 deletiontest/unit/json_path.result
Loading
Please register or sign in to comment