|
1 | 1 | --- The simple config module provides an ability to generate config (cfg) for
|
2 | 2 | --- tarantool_graphql using tarantool meta-information.
|
3 | 3 | ---
|
4 |
| ------- Explanation: |
| 4 | +--- Explanation: |
5 | 5 | ---
|
6 |
| ---- * To make use of it you must specify tarantool tuples' format during space |
7 |
| ---- creation passing or after it using space_object:format(). Spaces with no |
8 |
| ---- formats (both 'name and 'type' fields must be filled) will be ignored. |
9 |
| ---- Resulting schemas lack fields of the following types: 'record', 'array' |
10 |
| ---- and 'map'. Resulting collections have no connections. Schemas and |
11 |
| ---- collections may be complemented. |
| 6 | +--- To make use of it you must specify tarantool tuples' format during space |
| 7 | +--- creation passing or after it using space_object:format(). Spaces with no |
| 8 | +--- formats (both 'name and 'type' fields must be filled) will be ignored. |
| 9 | +--- Resulting schemas lack fields of the following types: 'record', 'array' |
| 10 | +--- and 'map'. Resulting collections have no connections. Schemas and |
| 11 | +--- collections may be complemented. |
12 | 12 |
|
13 | 13 | local check = require('graphql.utils').check
|
14 | 14 |
|
15 | 15 | local simple_config = {}
|
16 | 16 |
|
17 |
| ---- The functions tells if given space is a tarantool system space or not. |
18 |
| ---- It relies on tarantool implementation's details. The source of the function is |
19 |
| ---- space_is_system() in tarantool/src/box/schema.cc |
20 |
| -local function is_system_space(space) |
21 |
| - local BOX_SYSTEM_ID_MIN = 256 |
22 |
| - local BOX_SYSTEM_ID_MAX = 511 |
| 17 | +--- The functions tells wheter given space is a tarantool system space. |
| 18 | +--- |
| 19 | +--- Based on space_is_system() from ${TARANTOOL_REPO}/src/box/schema.cc. |
| 20 | +local function space_is_system(space) |
23 | 21 | local space_id = space[1]
|
24 |
| - return (BOX_SYSTEM_ID_MIN < space_id and space_id < BOX_SYSTEM_ID_MAX) |
| 22 | + return box.schema.SYSTEM_ID_MIN < space_id and |
| 23 | + space_id < box.schema.SYSTEM_ID_MAX |
25 | 24 | end
|
26 | 25 |
|
27 | 26 | --- The functions converts given tarantool tuple's (received from space:format())
|
@@ -159,7 +158,7 @@ function simple_config.get_spaces_formats()
|
159 | 158 | local FORMAT = 7
|
160 | 159 | local NAME = 3
|
161 | 160 | for _, s in box.space._space:pairs() do
|
162 |
| - if not is_system_space(s) then |
| 161 | + if not space_is_system(s) then |
163 | 162 | local space_format = unify_format(s[FORMAT])
|
164 | 163 | if is_fully_defined(space_format) then
|
165 | 164 | spaces_formats[s[NAME]] = space_format
|
|
0 commit comments