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

Function _DeleteGraphMetaKeys

src/module_event_handlers.c:169–211  ·  view source on GitHub ↗

delete meta keys, upon RDB encode or decode finished event triggering the decode flag represent the event

Source from the content-addressed store, hash-verified

167// delete meta keys, upon RDB encode or decode finished event triggering
168// the decode flag represent the event
169static void _DeleteGraphMetaKeys
170(
171 RedisModuleCtx *ctx,
172 GraphContext *gc,
173 bool decode
174) {
175 uint key_count;
176 unsigned char **keys;
177
178 // get the meta keys required, according to the "decode" flag.
179 if(decode) {
180 keys = GraphDecodeContext_GetMetaKeys(gc->decoding_context);
181 } else {
182 keys = GraphEncodeContext_GetMetaKeys(gc->encoding_context);
183 }
184
185 key_count = array_len(keys);
186 for(uint i = 0; i < key_count; i++) {
187 RedisModuleString *meta_rm_string =
188 RedisModule_CreateStringPrintf(ctx, "%s", keys[i]);
189
190 RedisModuleKey *key =
191 RedisModule_OpenKey(ctx, meta_rm_string, REDISMODULE_WRITE);
192
193 RedisModule_DeleteKey(key);
194 RedisModule_CloseKey(key);
195 RedisModule_FreeString(ctx, meta_rm_string);
196
197 rm_free(keys[i]);
198 }
199
200 array_free(keys);
201
202 // clear the relevant context meta keys as they are no longer valid
203 if(decode) {
204 GraphDecodeContext_ClearMetaKeys(gc->decoding_context);
205 } else {
206 GraphEncodeContext_ClearMetaKeys(gc->encoding_context);
207 }
208
209 RedisModule_Log(ctx, "notice", "Deleted %d virtual keys for graph %s",
210 key_count, gc->graph_name);
211}
212
213// create the meta keys for each graph in the keyspace
214// used on RDB start event

Callers 1

_ClearKeySpaceMetaKeysFunction · 0.85

Calls 7

array_lenFunction · 0.85
rm_freeFunction · 0.85
array_freeFunction · 0.85

Tested by

no test coverage detected