| 7119 | } |
| 7120 | |
| 7121 | static void RedisGearsPy_SaveRegistrations(RedisModuleIO *rdb, int when){ |
| 7122 | Gears_dictIterator *iter = Gears_dictGetIterator(RequirementsDict); |
| 7123 | Gears_dictEntry *entry = NULL; |
| 7124 | Gears_Buffer* buff = Gears_BufferCreate(); |
| 7125 | Gears_BufferWriter bw; |
| 7126 | Gears_BufferWriterInit(&bw, buff); |
| 7127 | while((entry = Gears_dictNext(iter))){ |
| 7128 | PythonRequirementCtx* req = Gears_dictGetVal(entry); |
| 7129 | Gears_BufferClear(buff); |
| 7130 | char* err = NULL; |
| 7131 | if(PythonRequirement_Serialize(req, &bw, &err) != REDISMODULE_OK){ |
| 7132 | RedisModule_LogIOError(rdb, "warning", "Failed serializing requirement %s (%s)", req->installName, err ? err : "Unknow error"); |
| 7133 | RG_FREE(err); |
| 7134 | }else{ |
| 7135 | // indicate there is another requirement |
| 7136 | RedisModule_SaveUnsigned(rdb, 1); |
| 7137 | RedisModule_SaveStringBuffer(rdb, buff->buff, buff->size); |
| 7138 | } |
| 7139 | } |
| 7140 | // indicate we are done |
| 7141 | RedisModule_SaveUnsigned(rdb, 0); |
| 7142 | Gears_dictReleaseIterator(iter); |
| 7143 | Gears_BufferFree(buff); |
| 7144 | } |
| 7145 | |
| 7146 | static int RedisGearsPy_CreateRequirementsDataType(RedisModuleCtx* ctx){ |
| 7147 | RedisModuleTypeMethods methods = { |
nothing calls this directly
no test coverage detected