Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 586cb88

Browse files
committed
Use box.schema.SYSTEM_ID_{MIN,MAX}
1 parent 087502a commit 586cb88

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

graphql/simple_config.lua

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
--- The simple config module provides an ability to generate config (cfg) for
22
--- tarantool_graphql using tarantool meta-information.
33
---
4-
------ Explanation:
4+
--- Explanation:
55
---
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.
1212

1313
local check = require('graphql.utils').check
1414

1515
local simple_config = {}
1616

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)
2321
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
2524
end
2625

2726
--- The functions converts given tarantool tuple's (received from space:format())
@@ -159,7 +158,7 @@ function simple_config.get_spaces_formats()
159158
local FORMAT = 7
160159
local NAME = 3
161160
for _, s in box.space._space:pairs() do
162-
if not is_system_space(s) then
161+
if not space_is_system(s) then
163162
local space_format = unify_format(s[FORMAT])
164163
if is_fully_defined(space_format) then
165164
spaces_formats[s[NAME]] = space_format

0 commit comments

Comments
 (0)