| 206 | } |
| 207 | |
| 208 | void GraphContext_MarkWriter(RedisModuleCtx *ctx, GraphContext *gc) { |
| 209 | RedisModuleString *graphID = RedisModule_CreateString(ctx, gc->graph_name, strlen(gc->graph_name)); |
| 210 | |
| 211 | // Reopen only if key exists (do not re-create) make sure key still exists. |
| 212 | RedisModuleKey *key = RedisModule_OpenKey(ctx, graphID, REDISMODULE_READ); |
| 213 | if(RedisModule_KeyType(key) == REDISMODULE_KEYTYPE_EMPTY) goto cleanup; |
| 214 | RedisModule_CloseKey(key); |
| 215 | |
| 216 | // Mark as writer. |
| 217 | key = RedisModule_OpenKey(ctx, graphID, REDISMODULE_WRITE); |
| 218 | RedisModule_CloseKey(key); |
| 219 | |
| 220 | cleanup: |
| 221 | RedisModule_FreeString(ctx, graphID); |
| 222 | } |
| 223 | |
| 224 | void GraphContext_LockForCommit |
| 225 | ( |