| 281 | } |
| 282 | |
| 283 | static 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 |
| 309 | static void _PersistenceEventHandler(RedisModuleCtx *ctx, RedisModuleEvent eid, |
nothing calls this directly
no test coverage detected