MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _RdbSaveSchema

Function _RdbSaveSchema

src/serializers/encoder/v13/encode_schema.c:186–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186static void _RdbSaveSchema(RedisModuleIO *rdb, Schema *s) {
187 /* Format:
188 * id
189 * name
190 * #indices
191 * (index type, indexed property) X M
192 * #constraints
193 * (constraint type, constraint fields) X N
194 */
195
196 // Schema ID.
197 RedisModule_SaveUnsigned(rdb, s->id);
198
199 // Schema name.
200 RedisModule_SaveStringBuffer(rdb, s->name, strlen(s->name) + 1);
201
202 // Number of indices.
203 RedisModule_SaveUnsigned(rdb, Schema_IndexCount(s));
204
205 // Exact match index, prefer pending over active
206 Index idx = PENDING_EXACTMATCH_IDX(s)
207 ? PENDING_EXACTMATCH_IDX(s)
208 : ACTIVE_EXACTMATCH_IDX(s);
209
210 _RdbSaveIndexData(rdb, s->type, idx);
211
212 // Fulltext indices.
213 idx = PENDING_FULLTEXT_IDX(s)
214 ? PENDING_FULLTEXT_IDX(s)
215 : ACTIVE_FULLTEXT_IDX(s);
216 _RdbSaveIndexData(rdb, s->type, idx);
217
218 // Constraints.
219 _RdbSaveConstraintsData(rdb, s->constraints);
220}
221
222void RdbSaveGraphSchema_v13(RedisModuleIO *rdb, GraphContext *gc) {
223 /* Format:

Callers 1

RdbSaveGraphSchema_v13Function · 0.85

Calls 3

Schema_IndexCountFunction · 0.85
_RdbSaveIndexDataFunction · 0.85
_RdbSaveConstraintsDataFunction · 0.85

Tested by

no test coverage detected