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

Function _RdbSaveConstraint

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

Source from the content-addressed store, hash-verified

116}
117
118static void _RdbSaveConstraint
119(
120 RedisModuleIO *rdb,
121 const Constraint c
122) {
123 /* Format:
124 * constraint type
125 * fields count
126 * field IDs */
127
128 // only encode active constraint
129 ASSERT(Constraint_GetStatus(c) == CT_ACTIVE);
130
131 //--------------------------------------------------------------------------
132 // encode constraint type
133 //--------------------------------------------------------------------------
134
135 ConstraintType t = Constraint_GetType(c);
136 RedisModule_SaveUnsigned(rdb, t);
137
138 //--------------------------------------------------------------------------
139 // encode constraint fields count
140 //--------------------------------------------------------------------------
141
142 const Attribute_ID *attrs;
143 uint8_t n = Constraint_GetAttributes(c, &attrs, NULL);
144 RedisModule_SaveUnsigned(rdb, n);
145
146 //--------------------------------------------------------------------------
147 // encode constraint fields
148 //--------------------------------------------------------------------------
149
150 for(uint8_t i = 0; i < n; i++) {
151 Attribute_ID attr = attrs[i];
152 RedisModule_SaveUnsigned(rdb, attr);
153 }
154}
155
156static void _RdbSaveConstraintsData
157(

Callers 1

_RdbSaveConstraintsDataFunction · 0.85

Calls 3

Constraint_GetStatusFunction · 0.85
Constraint_GetTypeFunction · 0.85
Constraint_GetAttributesFunction · 0.85

Tested by

no test coverage detected