Skip to content
Snippets Groups Projects
Commit 928e5733 authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Vladimir Davydov
Browse files

box: add `space_id_is_system` helper

In some cases we don't have the whole space struct, but we want to
determine whether the provided space identifier corresponds to a system
space — add a `space_id_is_system` helper and refactor `space_is_system` to
reuse it.

Needed for #7974

NO_CHANGELOG=refactoring
NO_DOC=refactoring
NO_TEST=refactoring
parent 24dd505f
No related branches found
No related tags found
No related merge requests found
...@@ -345,6 +345,18 @@ schema_object_name(enum schema_object_type type); ...@@ -345,6 +345,18 @@ schema_object_name(enum schema_object_type type);
const char * const char *
schema_entity_name(enum schema_object_type type); schema_entity_name(enum schema_object_type type);
/**
* Check that the space id corresponds to a system space, which means that is
* has a special meaning for tarantool and has predefined insert/remove
* triggers.
*/
static inline bool
space_id_is_system(uint32_t space_id)
{
return space_id > BOX_SYSTEM_ID_MIN &&
space_id < BOX_SYSTEM_ID_MAX;
}
#if defined(__cplusplus) #if defined(__cplusplus)
} /* extern "C" */ } /* extern "C" */
#endif /* defined(__cplusplus) */ #endif /* defined(__cplusplus) */
......
...@@ -122,8 +122,7 @@ space_fill_index_map(struct space *space) ...@@ -122,8 +122,7 @@ space_fill_index_map(struct space *space)
bool bool
space_is_system(const struct space *space) space_is_system(const struct space *space)
{ {
return space->def->id > BOX_SYSTEM_ID_MIN && return space_id_is_system(space->def->id);
space->def->id < BOX_SYSTEM_ID_MAX;
} }
/** /**
......
...@@ -541,8 +541,7 @@ space_is_vinyl(const struct space *space) ...@@ -541,8 +541,7 @@ space_is_vinyl(const struct space *space)
} }
/** /**
* Check that the space is a system space, which means that is has a special * Check that the space is a system space, see also `space_id_is_system`.
* meaning for tarantool and has predefined insert/remove triggers.
*/ */
bool bool
space_is_system(const struct space *space); space_is_system(const struct space *space);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment