Repository: valkey-io/valkey
File: src/valkeymodule.h (C/C++)

Code before:
 * - `code`: string pointer to the source code.
 *
 * - `code_len`: The length of the code string.
 *
 * - `timeout`: timeout for the library creation (0 for no timeout).
 *
 * - `out_num_compiled_functions`: out param with the number of objects
 *   returned by this function.
 *
 * - `err` - out param with the description of error (if occurred).
 *
 * Returns an array of compiled function objects, or `NULL` if some error
 * occurred.
 */
typedef ValkeyModuleScriptingEngineCompiledFunction **(*ValkeyModuleScriptingEngineCompileCodeFunc)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    const char *code,
    size_t code_len,
    size_t timeout,
    size_t *out_num_compiled_functions,
    ValkeyModuleString **err);

/* Version one of source code compilation interface. This API does not allow the compiler to
 * safely handle binary data. You should use a newer version of the API if possible.
typedef ValkeyModuleScriptingEngineCompiledFunctionV1 **(*ValkeyModuleScriptingEngineCompileCodeFuncV1)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    const char *code,
    size_t timeout,
    size_t *out_num_compiled_functions,
    ValkeyModuleString **err);

/* Free the given function.
 *
 * - `module_ctx`: the module runtime context.
 *
 * - `engine_ctx`: the scripting engine runtime context.
 *
 * - `type`: the subsystem where the function is associated with, either `EVAL`
 *   or `FUNCTION`.
 *
 * - `compiled_function`: the compiled function to be freed.
 */
typedef void (*ValkeyModuleScriptingEngineFreeFunctionFunc)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    ValkeyModuleScriptingEngineCompiledFunction *compiled_function);

Review comment (suggestion):
```suggestion
 * safely handle binary data. You should use a newer version of the API if possible. */
```

Code after:
 * - `code`: string pointer to the source code.
 *
 * - `code_len`: The length of the code string.
 *
 * - `timeout`: timeout for the library creation (0 for no timeout).
 *
 * - `out_num_compiled_functions`: out param with the number of objects
 *   returned by this function.
 *
 * - `err` - out param with the description of error (if occurred).
 *
 * Returns an array of compiled function objects, or `NULL` if some error
 * occurred.
 */
typedef ValkeyModuleScriptingEngineCompiledFunction **(*ValkeyModuleScriptingEngineCompileCodeFunc)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    const char *code,
    size_t code_len,
    size_t timeout,
    size_t *out_num_compiled_functions,
    ValkeyModuleString **err);

/* Version one of source code compilation interface. This API does not allow the compiler to
 * safely handle binary data. You should use a newer version of the API if possible. */
typedef ValkeyModuleScriptingEngineCompiledFunctionV1 **(*ValkeyModuleScriptingEngineCompileCodeFuncV1)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    const char *code,
    size_t timeout,
    size_t *out_num_compiled_functions,
    ValkeyModuleString **err);

/* Free the given function.
 *
 * - `module_ctx`: the module runtime context.
 *
 * - `engine_ctx`: the scripting engine runtime context.
 *
 * - `type`: the subsystem where the function is associated with, either `EVAL`
 *   or `FUNCTION`.
 *
 * - `compiled_function`: the compiled function to be freed.
 */
typedef void (*ValkeyModuleScriptingEngineFreeFunctionFunc)(
    ValkeyModuleCtx *module_ctx,
    ValkeyModuleScriptingEngineCtx *engine_ctx,
    ValkeyModuleScriptingEngineSubsystemType type,
    ValkeyModuleScriptingEngineCompiledFunction *compiled_function);