Disable keyspec module API in 7.0 RC1 (#10135)
The keyspec API is not yet released and there is a plan to change it in #10108, which is going to be included in RC2. Therefore, we hide it in RC1 to avoid introducing a breaking change in RC2. Co-authored-by: Oran Agra <oran@redislabs.com>
This commit is contained in:
parent
6dc3f09cb9
commit
857dc5bacd
@ -1198,7 +1198,10 @@ int moduleSetCommandKeySpecFindKeys(RedisModuleCommand *command, int index, keyS
|
||||
return REDISMODULE_OK;
|
||||
}
|
||||
|
||||
/* Key specs is a scheme that tries to describe the location
|
||||
/* **The key spec API is not officially released and it is going to be changed
|
||||
* in Redis 7.0. It has been disabled temporarily.**
|
||||
*
|
||||
* Key specs is a scheme that tries to describe the location
|
||||
* of key arguments better than the old [first,last,step] scheme
|
||||
* which is limited and doesn't fit many commands.
|
||||
*
|
||||
@ -11095,11 +11098,13 @@ void moduleRegisterCoreAPI(void) {
|
||||
REGISTER_API(DefragShouldStop);
|
||||
REGISTER_API(DefragCursorSet);
|
||||
REGISTER_API(DefragCursorGet);
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
REGISTER_API(AddCommandKeySpec);
|
||||
REGISTER_API(SetCommandKeySpecBeginSearchIndex);
|
||||
REGISTER_API(SetCommandKeySpecBeginSearchKeyword);
|
||||
REGISTER_API(SetCommandKeySpecFindKeysRange);
|
||||
REGISTER_API(SetCommandKeySpecFindKeysKeynum);
|
||||
#endif
|
||||
REGISTER_API(EventLoopAdd);
|
||||
REGISTER_API(EventLoopDel);
|
||||
REGISTER_API(EventLoopAddOneShot);
|
||||
|
@ -924,11 +924,14 @@ REDISMODULE_API int (*RedisModule_GetKeyspaceNotificationFlagsAll)() REDISMODULE
|
||||
REDISMODULE_API int (*RedisModule_IsSubEventSupported)(RedisModuleEvent event, uint64_t subevent) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_GetServerVersion)() REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_GetTypeMethodVersion)() REDISMODULE_ATTR;
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
REDISMODULE_API int (*RedisModule_AddCommandKeySpec)(RedisModuleCommand *command, const char *specflags, int *spec_id) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_SetCommandKeySpecBeginSearchIndex)(RedisModuleCommand *command, int spec_id, int index) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_SetCommandKeySpecBeginSearchKeyword)(RedisModuleCommand *command, int spec_id, const char *keyword, int startfrom) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_SetCommandKeySpecFindKeysRange)(RedisModuleCommand *command, int spec_id, int lastkey, int keystep, int limit) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_SetCommandKeySpecFindKeysKeynum)(RedisModuleCommand *command, int spec_id, int keynumidx, int firstkey, int keystep) REDISMODULE_ATTR;
|
||||
#endif
|
||||
|
||||
REDISMODULE_API void (*RedisModule_Yield)(RedisModuleCtx *ctx, int flags, const char *busy_reply) REDISMODULE_ATTR;
|
||||
REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClient)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms) REDISMODULE_ATTR;
|
||||
REDISMODULE_API int (*RedisModule_UnblockClient)(RedisModuleBlockedClient *bc, void *privdata) REDISMODULE_ATTR;
|
||||
@ -1247,11 +1250,13 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
|
||||
REDISMODULE_GET_API(IsSubEventSupported);
|
||||
REDISMODULE_GET_API(GetServerVersion);
|
||||
REDISMODULE_GET_API(GetTypeMethodVersion);
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
REDISMODULE_GET_API(AddCommandKeySpec);
|
||||
REDISMODULE_GET_API(SetCommandKeySpecBeginSearchIndex);
|
||||
REDISMODULE_GET_API(SetCommandKeySpecBeginSearchKeyword);
|
||||
REDISMODULE_GET_API(SetCommandKeySpecFindKeysRange);
|
||||
REDISMODULE_GET_API(SetCommandKeySpecFindKeysKeynum);
|
||||
#endif
|
||||
REDISMODULE_GET_API(Yield);
|
||||
REDISMODULE_GET_API(GetThreadSafeContext);
|
||||
REDISMODULE_GET_API(GetDetachedThreadSafeContext);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "redismodule.h"
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
|
||||
#define UNUSED(V) ((void) V)
|
||||
|
||||
@ -112,3 +113,4 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
|
||||
|
||||
return REDISMODULE_OK;
|
||||
}
|
||||
#endif
|
||||
|
@ -42,23 +42,27 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
|
||||
return REDISMODULE_ERR;
|
||||
RedisModuleCommand *subcmd = RedisModule_GetCommand(ctx,"subcommands.bitarray|set");
|
||||
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
if (RedisModule_AddCommandKeySpec(subcmd,"RW UPDATE",&spec_id) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
if (RedisModule_SetCommandKeySpecBeginSearchIndex(subcmd,spec_id,1) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
if (RedisModule_SetCommandKeySpecFindKeysRange(subcmd,spec_id,0,1,0) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
#endif
|
||||
|
||||
if (RedisModule_CreateSubcommand(parent,"get",cmd_get,"",0,0,0) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
subcmd = RedisModule_GetCommand(ctx,"subcommands.bitarray|get");
|
||||
|
||||
#ifdef INCLUDE_UNRELEASED_KEYSPEC_API
|
||||
if (RedisModule_AddCommandKeySpec(subcmd,"RO ACCESS",&spec_id) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
if (RedisModule_SetCommandKeySpecBeginSearchIndex(subcmd,spec_id,1) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
if (RedisModule_SetCommandKeySpecFindKeysRange(subcmd,spec_id,0,1,0) == REDISMODULE_ERR)
|
||||
return REDISMODULE_ERR;
|
||||
#endif
|
||||
|
||||
/* Get the name of the command currently running. */
|
||||
if (RedisModule_CreateCommand(ctx,"subcommands.parent_get_fullname",cmd_get_fullname,"",0,0,0) == REDISMODULE_ERR)
|
||||
|
@ -1,4 +1,5 @@
|
||||
set testmodule [file normalize tests/modules/keyspecs.so]
|
||||
if 0 { ; # Test suite disabled due to planned API changes
|
||||
|
||||
start_server {tags {"modules"}} {
|
||||
r module load $testmodule
|
||||
@ -53,3 +54,5 @@ start_server {tags {"modules"}} {
|
||||
assert_equal {OK} [r module unload keyspecs]
|
||||
}
|
||||
}
|
||||
|
||||
} ; # Test suite disabled
|
||||
|
@ -8,8 +8,13 @@ start_server {tags {"modules"}} {
|
||||
set command_reply [r command info subcommands.bitarray]
|
||||
set first_cmd [lindex $command_reply 0]
|
||||
set subcmds_in_command [lsort [lindex $first_cmd 9]]
|
||||
assert_equal [lindex $subcmds_in_command 0] {subcommands.bitarray|get -2 module 1 1 1 {} {} {{flags {RO access} begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}}
|
||||
assert_equal [lindex $subcmds_in_command 1] {subcommands.bitarray|set -2 module 1 1 1 {} {} {{flags {RW update} begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}}
|
||||
if 0 { ; # Keyspecs disabled due to planned changes in keyspec API
|
||||
assert_equal [lindex $subcmds_in_command 0] {subcommands.bitarray|get -2 module 1 1 1 {} {} {{flags {RO access} begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}}
|
||||
assert_equal [lindex $subcmds_in_command 1] {subcommands.bitarray|set -2 module 1 1 1 {} {} {{flags {RW update} begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}}
|
||||
} else { ; # The same asserts without the key specs
|
||||
assert_equal [lindex $subcmds_in_command 0] {subcommands.bitarray|get -2 module 0 0 0 {} {} {} {}}
|
||||
assert_equal [lindex $subcmds_in_command 1] {subcommands.bitarray|set -2 module 0 0 0 {} {} {} {}}
|
||||
}
|
||||
|
||||
# Verify that module subcommands are displayed correctly in COMMAND DOCS
|
||||
set docs_reply [r command docs subcommands.bitarray]
|
||||
|
Loading…
x
Reference in New Issue
Block a user