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

Function _ReplicationRoleChangedEventHandler

src/module_event_handlers.c:283–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283static void _ReplicationRoleChangedEventHandler
284(
285 RedisModuleCtx *ctx,
286 RedisModuleEvent eid,
287 uint64_t subevent,
288 void *data
289) {
290 KeySpaceGraphIterator it;
291 GraphContext *gc = NULL;
292 Globals_ScanGraphs(&it);
293 if(subevent == REDISMODULE_EVENT_REPLROLECHANGED_NOW_MASTER) {
294 // now master enable constraints
295 while((gc = GraphIterator_Next(&it)) != NULL) {
296 GraphContext_EnableConstrains(gc);
297 GraphContext_DecreaseRefCount(gc);
298 }
299 } else if (subevent == REDISMODULE_EVENT_REPLROLECHANGED_NOW_REPLICA) {
300 // now slave disable constraints
301 while((gc = GraphIterator_Next(&it)) != NULL) {
302 GraphContext_DisableConstrains(gc);
303 GraphContext_DecreaseRefCount(gc);
304 }
305 }
306}
307
308// server persistence event handler
309static void _PersistenceEventHandler(RedisModuleCtx *ctx, RedisModuleEvent eid,

Callers

nothing calls this directly

Calls 5

Globals_ScanGraphsFunction · 0.85
GraphIterator_NextFunction · 0.85

Tested by

no test coverage detected