Skip to content

Commit 4ff2dd1

Browse files
authored
align redismodule.h with Redis Delay Trimming feature (#79)
* redismodule.h with DelayTrimming flags * update * align with new new commits * align with dedicated api * align latest
1 parent 69baff4 commit 4ff2dd1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

redismodule.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ typedef long long ustime_t;
4646
/* API versions. */
4747
#define REDISMODULE_APIVER_1 1
4848

49-
/* Version of the RedisModuleTypeMethods structure. Once the RedisModuleTypeMethods
49+
/* Version of the RedisModuleTypeMethods structure. Once the RedisModuleTypeMethods
5050
* structure is changed, this version number needs to be changed synchronistically. */
5151
#define REDISMODULE_TYPE_METHOD_VERSION 5
5252

@@ -67,11 +67,14 @@ typedef long long ustime_t;
6767
#define REDISMODULE_OPEN_KEY_NOEFFECTS (1<<20)
6868
/* Allow access expired key that haven't deleted yet */
6969
#define REDISMODULE_OPEN_KEY_ACCESS_EXPIRED (1<<21)
70+
/* Allow access trimmed key that haven't deleted yet */
71+
#define REDISMODULE_OPEN_KEY_ACCESS_TRIMMED (1<<22)
72+
7073

7174
/* Mask of all REDISMODULE_OPEN_KEY_* values. Any new mode should be added to this list.
7275
* Should not be used directly by the module, use RM_GetOpenKeyModesAll instead.
7376
* Located here so when we will add new modes we will not forget to update it. */
74-
#define _REDISMODULE_OPEN_KEY_ALL REDISMODULE_READ | REDISMODULE_WRITE | REDISMODULE_OPEN_KEY_NOTOUCH | REDISMODULE_OPEN_KEY_NONOTIFY | REDISMODULE_OPEN_KEY_NOSTATS | REDISMODULE_OPEN_KEY_NOEXPIRE | REDISMODULE_OPEN_KEY_NOEFFECTS | REDISMODULE_OPEN_KEY_ACCESS_EXPIRED
77+
#define _REDISMODULE_OPEN_KEY_ALL REDISMODULE_READ | REDISMODULE_WRITE | REDISMODULE_OPEN_KEY_NOTOUCH | REDISMODULE_OPEN_KEY_NONOTIFY | REDISMODULE_OPEN_KEY_NOSTATS | REDISMODULE_OPEN_KEY_NOEXPIRE | REDISMODULE_OPEN_KEY_NOEFFECTS | REDISMODULE_OPEN_KEY_ACCESS_EXPIRED | REDISMODULE_OPEN_KEY_ACCESS_TRIMMED
7578

7679
/* List push and pop */
7780
#define REDISMODULE_LIST_HEAD 0
@@ -126,7 +129,7 @@ typedef long long ustime_t;
126129
#define REDISMODULE_HASH_CFIELDS (1<<2)
127130
#define REDISMODULE_HASH_EXISTS (1<<3)
128131
#define REDISMODULE_HASH_COUNT_ALL (1<<4)
129-
#define REDISMODULE_HASH_EXPIRE_TIME (1<<5)
132+
#define REDISMODULE_HASH_EXPIRE_TIME (1<<5)
130133

131134
#define REDISMODULE_CONFIG_DEFAULT 0 /* This is the default for a module config. */
132135
#define REDISMODULE_CONFIG_IMMUTABLE (1ULL<<0) /* Can this value only be set at startup? */
@@ -215,11 +218,13 @@ typedef struct RedisModuleStreamID {
215218
#define REDISMODULE_CTX_FLAGS_SERVER_STARTUP (1<<24)
216219
/* This context can call execute debug commands. */
217220
#define REDISMODULE_CTX_FLAGS_DEBUG_ENABLED (1<<25)
221+
/* Trim is in progress due to slot migration. */
222+
#define REDISMODULE_CTX_FLAGS_TRIM_IN_PROGRESS (1<<26)
218223

219224
/* Next context flag, must be updated when adding new flags above!
220225
This flag should not be used directly by the module.
221226
* Use RedisModule_GetContextFlagsAll instead. */
222-
#define _REDISMODULE_CTX_FLAGS_NEXT (1<<26)
227+
#define _REDISMODULE_CTX_FLAGS_NEXT (1<<27)
223228

224229
/* Keyspace changes notification classes. Every class is associated with a
225230
* character for configuration purposes.
@@ -604,7 +609,7 @@ static const RedisModuleEvent
604609
/* Deprecated since Redis 7.0, not used anymore. */
605610
__attribute__ ((deprecated))
606611
RedisModuleEvent_ReplBackup = {
607-
REDISMODULE_EVENT_REPL_BACKUP,
612+
REDISMODULE_EVENT_REPL_BACKUP,
608613
1
609614
},
610615
RedisModuleEvent_ReplAsyncLoad = {
@@ -1343,6 +1348,8 @@ REDISMODULE_API void (*RedisModule_GetRandomBytes)(unsigned char *dst, size_t le
13431348
REDISMODULE_API void (*RedisModule_GetRandomHexChars)(char *dst, size_t len) REDISMODULE_ATTR;
13441349
REDISMODULE_API void (*RedisModule_SetDisconnectCallback)(RedisModuleBlockedClient *bc, RedisModuleDisconnectFunc callback) REDISMODULE_ATTR;
13451350
REDISMODULE_API void (*RedisModule_SetClusterFlags)(RedisModuleCtx *ctx, uint64_t flags) REDISMODULE_ATTR;
1351+
REDISMODULE_API int (*RedisModule_ClusterDisableTrim)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
1352+
REDISMODULE_API int (*RedisModule_ClusterEnableTrim)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
13461353
REDISMODULE_API unsigned int (*RedisModule_ClusterKeySlot)(RedisModuleString *key) REDISMODULE_ATTR;
13471354
REDISMODULE_API unsigned int (*RedisModule_ClusterKeySlotC)(const char *keystr, size_t keylen) REDISMODULE_ATTR;
13481355
REDISMODULE_API const char *(*RedisModule_ClusterCanonicalKeyNameInSlot)(unsigned int slot) REDISMODULE_ATTR;
@@ -1740,6 +1747,8 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
17401747
REDISMODULE_GET_API(GetRandomBytes);
17411748
REDISMODULE_GET_API(GetRandomHexChars);
17421749
REDISMODULE_GET_API(SetClusterFlags);
1750+
REDISMODULE_GET_API(ClusterDisableTrim);
1751+
REDISMODULE_GET_API(ClusterEnableTrim);
17431752
REDISMODULE_GET_API(ClusterKeySlot);
17441753
REDISMODULE_GET_API(ClusterKeySlotC);
17451754
REDISMODULE_GET_API(ClusterCanonicalKeyNameInSlot);
@@ -1828,9 +1837,8 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
18281837
REDISMODULE_GET_API(ConfigSetEnum);
18291838
REDISMODULE_GET_API(ConfigSetNumeric);
18301839

1831-
18321840
#ifdef REDISMODULE_RLEC_API_DEFS
1833-
REDISMODULE_RLEC_API_DEFS
1841+
REDISMODULE_RLEC_API_DEFS
18341842
#endif
18351843

18361844
if (RedisModule_IsModuleNameBusy && RedisModule_IsModuleNameBusy(name)) return REDISMODULE_ERR;

0 commit comments

Comments
 (0)