| 94 | } |
| 95 | |
| 96 | int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { |
| 97 | if(RedisModule_Init(ctx, "graph", REDISGRAPH_MODULE_VERSION, |
| 98 | REDISMODULE_APIVER_1) == REDISMODULE_ERR) { |
| 99 | return REDISMODULE_ERR; |
| 100 | } |
| 101 | |
| 102 | // initialize GraphBLAS |
| 103 | int res = GraphBLAS_Init(ctx); |
| 104 | if(res != REDISMODULE_OK) return res; |
| 105 | |
| 106 | // validate minimum redis-server version |
| 107 | if(!Redis_Version_GreaterOrEqual(MIN_REDIS_VERION_MAJOR, |
| 108 | MIN_REDIS_VERION_MINOR, MIN_REDIS_VERION_PATCH)) { |
| 109 | RedisModule_Log(ctx, "warning", "RedisGraph requires redis-server version %d.%d.%d and up", |
| 110 | MIN_REDIS_VERION_MAJOR, MIN_REDIS_VERION_MINOR, MIN_REDIS_VERION_PATCH); |
| 111 | return REDISMODULE_ERR; |
| 112 | } |
| 113 | |
| 114 | if(RediSearch_Init(ctx, REDISEARCH_INIT_LIBRARY) != REDISMODULE_OK) { |
| 115 | return REDISMODULE_ERR; |
| 116 | } |
| 117 | |
| 118 | RedisModule_Log(ctx, "notice", "Starting up RedisGraph version %d.%d.%d.", |
| 119 | REDISGRAPH_VERSION_MAJOR, REDISGRAPH_VERSION_MINOR, REDISGRAPH_VERSION_PATCH); |
| 120 | |
| 121 | Proc_Register(); // register procedures |
| 122 | AR_RegisterFuncs(); // register arithmetic functions |
| 123 | |
| 124 | // set up the module's configurable variables, |
| 125 | // using user-defined values where provided |
| 126 | // register for config updates |
| 127 | Config_Subscribe_Changes(reconf_handler); |
| 128 | if(Config_Init(ctx, argv, argc) != REDISMODULE_OK) return REDISMODULE_ERR; |
| 129 | |
| 130 | RegisterEventHandlers(ctx); |
| 131 | |
| 132 | // create thread local storage keys for query and error contexts |
| 133 | if(!_Cron_Start()) return REDISMODULE_ERR; |
| 134 | if(!QueryCtx_Init()) return REDISMODULE_ERR; |
| 135 | if(!ErrorCtx_Init()) return REDISMODULE_ERR; |
| 136 | if(!ThreadPools_Init()) return REDISMODULE_ERR; |
| 137 | if(!Indexer_Init()) return REDISMODULE_ERR; |
| 138 | if(!AST_ValidationsMappingInit()) return REDISMODULE_ERR; |
| 139 | |
| 140 | RedisModule_Log(ctx, "notice", "Thread pool created, using %d threads.", |
| 141 | ThreadPools_ReadersCount()); |
| 142 | |
| 143 | int ompThreadCount; |
| 144 | Config_Option_get(Config_OPENMP_NTHREAD, &ompThreadCount); |
| 145 | |
| 146 | if(GxB_set(GxB_NTHREADS, ompThreadCount) != GrB_SUCCESS) { |
| 147 | RedisModule_Log(ctx, "warning", "Failed to set OpenMP thread count to %d", ompThreadCount); |
| 148 | return REDISMODULE_ERR; |
| 149 | } |
| 150 | |
| 151 | // log configuration |
| 152 | _Print_Config(ctx); |
| 153 |
nothing calls this directly
no test coverage detected