• Ozan Tezcan's avatar
    Add RM_RdbLoad and RM_RdbSave module API functions (#11852) · e55568ed
    Ozan Tezcan authored
    Add `RM_RdbLoad()` and `RM_RdbSave()` to load/save RDB files from the module API. 
    
    In our use case, we have our clustering implementation as a module. As part of this
    implementation, the module needs to trigger RDB save operation at specific points.
    Also, this module delivers RDB files to other nodes (not using Redis' replication).
    When a node receives an RDB file, it should be able to load the RDB. Currently,
    there is no module API to save/load RDB files. 
    
    
    This PR adds four new APIs:
    ```c
    RedisModuleRdbStream *RM_RdbStreamCreateFromFile(const char *filename);
    void RM_RdbStreamFree(RedisModuleRdbStream *stream);
    
    int RM_RdbLoad(RedisModuleCtx *ctx, RedisModuleRdbStream *stream, int flags);
    int RM_RdbSave(RedisModuleCtx *ctx, RedisModuleRdbStream *stream, int flags);
    ```
    
    The first step is to create a `RedisModuleRdbStream` object. This PR provides a function to
    create RedisModuleRdbStream from the filename. (You can load/sav...
    e55568ed
runtest-moduleapi 1.73 KB