diff --git a/Cargo.toml b/Cargo.toml index cef0114c..4f91f61b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -148,6 +148,7 @@ cc = "1" [features] default = ["min-redis-compatibility-version-6-0"] +min-redis-compatibility-version-7-4 = ["redis-module/min-redis-compatibility-version-7-4"] min-redis-compatibility-version-7-2 = ["redis-module/min-redis-compatibility-version-7-2"] min-redis-compatibility-version-7-0 = ["redis-module/min-redis-compatibility-version-7-0"] min-redis-compatibility-version-6-2 = ["redis-module/min-redis-compatibility-version-6-2"] diff --git a/build.sh b/build.sh index 4b2fb572..a678407d 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh -cargo build --all --all-targets --no-default-features +cargo build --all --all-targets --no-default-features --features min-redis-compatibility-version-7-4 diff --git a/redismodule-rs-macros-internals/src/api_versions.rs b/redismodule-rs-macros-internals/src/api_versions.rs index 0faf3f55..6da52e8e 100644 --- a/redismodule-rs-macros-internals/src/api_versions.rs +++ b/redismodule-rs-macros-internals/src/api_versions.rs @@ -5,6 +5,7 @@ use quote::quote; lazy_static::lazy_static! { pub(crate) static ref API_VERSION_MAPPING: HashMap = HashMap::from([ + ("RedisModule_AddACLCategory".to_string(), 70400), ("RedisModule_AddPostNotificationJob".to_string(), 70200), ("RedisModule_SetCommandACLCategories".to_string(), 70200), ("RedisModule_GetOpenKeyModesAll".to_string(), 70200), @@ -30,6 +31,7 @@ lazy_static::lazy_static! { (60200, "min-redis-compatibility-version-6-2".to_string()), (70000, "min-redis-compatibility-version-7-0".to_string()), (70200, "min-redis-compatibility-version-7-2".to_string()), + (70400, "min-redis-compatibility-version-7-4".to_string()), ]; } diff --git a/src/context/commands.rs b/src/context/commands.rs index f926a7d6..a3ad3a54 100644 --- a/src/context/commands.rs +++ b/src/context/commands.rs @@ -471,6 +471,7 @@ api! {[ #[cfg(all( any( + feature = "min-redis-compatibility-version-7-4", feature = "min-redis-compatibility-version-7-2", feature = "min-redis-compatibility-version-7-0" ), @@ -495,6 +496,7 @@ pub fn register_commands(ctx: &Context) -> Status { feature = "min-redis-compatibility-version-6-0" ), not(any( + feature = "min-redis-compatibility-version-7-4", feature = "min-redis-compatibility-version-7-2", feature = "min-redis-compatibility-version-7-0" )) diff --git a/src/context/mod.rs b/src/context/mod.rs index 0b92affb..5d0432a8 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -54,7 +54,10 @@ pub struct CallOptions { } #[derive(Clone)] -#[cfg(feature = "min-redis-compatibility-version-7-2")] +#[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" +))] pub struct BlockingCallOptions { options: CString, } @@ -136,7 +139,10 @@ impl CallOptionsBuilder { /// Construct a CallOption object that can be used to run commands using call_blocking. /// The commands can be either blocking or none blocking. In case the command are blocking /// (like `blpop`) a [FutureCallReply] will be returned. - #[cfg(feature = "min-redis-compatibility-version-7-2")] + #[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" + ))] pub fn build_blocking(mut self) -> BlockingCallOptions { self.add_flag("K"); BlockingCallOptions { @@ -441,7 +447,10 @@ impl Context { } /// Same as [call_ext] but also allow to perform blocking commands like BLPOP. - #[cfg(feature = "min-redis-compatibility-version-7-2")] + #[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" + ))] pub fn call_blocking< 'ctx, 'a, diff --git a/src/include/redismodule.h b/src/include/redismodule.h index efd496b5..b65a552b 100644 --- a/src/include/redismodule.h +++ b/src/include/redismodule.h @@ -969,6 +969,7 @@ REDISMODULE_API RedisModuleCommand *(*RedisModule_GetCommand)(RedisModuleCtx *ct REDISMODULE_API int (*RedisModule_CreateSubcommand)(RedisModuleCommand *parent, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_SetCommandInfo)(RedisModuleCommand *command, const RedisModuleCommandInfo *info) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_SetCommandACLCategories)(RedisModuleCommand *command, const char *ctgrsflags) REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_AddACLCategory)(RedisModuleCtx *ctx, const char *name) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_SetModuleAttribs)(RedisModuleCtx *ctx, const char *name, int ver, int apiver) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_IsModuleNameBusy)(const char *name) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_WrongArity)(RedisModuleCtx *ctx) REDISMODULE_ATTR; diff --git a/src/lib.rs b/src/lib.rs index 1dba966a..9a11b0be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,10 @@ pub use crate::context::defrag; pub use crate::context::keys_cursor::KeysCursor; pub use crate::context::server_events; pub use crate::context::AclPermissions; -#[cfg(feature = "min-redis-compatibility-version-7-2")] +#[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" +))] pub use crate::context::BlockingCallOptions; pub use crate::context::CallOptionResp; pub use crate::context::CallOptions; diff --git a/tests/integration.rs b/tests/integration.rs index e8aafb93..114da8fc 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -279,7 +279,10 @@ fn test_stream_reader() -> Result<()> { } #[test] -#[cfg(feature = "min-redis-compatibility-version-7-2")] +#[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" +))] fn test_call() -> Result<()> { let port: u16 = 6488; let _guards = vec![start_redis_server_with_module("call", port) @@ -631,7 +634,10 @@ fn test_redis_value_derive() -> Result<()> { } #[test] -#[cfg(feature = "min-redis-compatibility-version-7-2")] +#[cfg(any( + feature = "min-redis-compatibility-version-7-4", + feature = "min-redis-compatibility-version-7-2" +))] fn test_call_blocking() -> Result<()> { let port: u16 = 6499; let _guards = vec![start_redis_server_with_module("call", port)