Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d131921c
Commit
d131921c
authored
Sep 27, 2017
by
Dvir Volk
Committed by
antirez
Oct 04, 2017
Browse files
Renamed GetCtxFlags to GetContextFlags
parent
2e71edcc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
d131921c
...
...
@@ -1290,7 +1290,7 @@ int RM_GetSelectedDb(RedisModuleCtx *ctx) {
* * REDISMODULE_CTX_FLAGS_EVICT: Maxmemory is set and has an eviction
* policy that may delete keys
*/
int
RM_GetCt
x
Flags
(
RedisModuleCtx
*
ctx
)
{
int
RM_GetC
ontex
tFlags
(
RedisModuleCtx
*
ctx
)
{
int
flags
=
0
;
/* Client specific flags */
...
...
@@ -3959,7 +3959,7 @@ void moduleRegisterCoreAPI(void) {
REGISTER_API
(
IsKeysPositionRequest
);
REGISTER_API
(
KeyAtPos
);
REGISTER_API
(
GetClientId
);
REGISTER_API
(
GetCt
x
Flags
);
REGISTER_API
(
GetC
ontex
tFlags
);
REGISTER_API
(
PoolAlloc
);
REGISTER_API
(
CreateDataType
);
REGISTER_API
(
ModuleTypeSetValue
);
...
...
src/modules/testmodule.c
View file @
d131921c
...
...
@@ -121,7 +121,7 @@ int TestStringPrintf(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
}
/* TEST.CTXFLAGS -- Test GetCt
x
Flags. */
/* TEST.CTXFLAGS -- Test GetC
ontex
tFlags. */
int
TestCtxFlags
(
RedisModuleCtx
*
ctx
,
RedisModuleString
**
argv
,
int
argc
)
{
REDISMODULE_NOT_USED
(
argc
);
REDISMODULE_NOT_USED
(
argv
);
...
...
@@ -138,7 +138,7 @@ int TestCtxFlags(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
goto end; \
}
int
flags
=
RedisModule_GetCt
x
Flags
(
ctx
);
int
flags
=
RedisModule_GetC
ontex
tFlags
(
ctx
);
if
(
flags
==
0
)
{
FAIL
(
"Got no flags"
);
}
...
...
@@ -149,14 +149,14 @@ int TestCtxFlags(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if
(
flags
&
REDISMODULE_CTX_FLAGS_AOF
)
FAIL
(
"AOF Flag was set"
)
/* Enable AOF to test AOF flags */
RedisModule_Call
(
ctx
,
"config"
,
"ccc"
,
"set"
,
"appendonly"
,
"yes"
);
flags
=
RedisModule_GetCt
x
Flags
(
ctx
);
flags
=
RedisModule_GetC
ontex
tFlags
(
ctx
);
if
(
!
(
flags
&
REDISMODULE_CTX_FLAGS_AOF
))
FAIL
(
"AOF Flag not set after config set"
);
if
(
flags
&
REDISMODULE_CTX_FLAGS_RDB
)
FAIL
(
"RDB Flag was set"
);
/* Enable RDB to test RDB flags */
RedisModule_Call
(
ctx
,
"config"
,
"ccc"
,
"set"
,
"save"
,
"900 1"
);
flags
=
RedisModule_GetCt
x
Flags
(
ctx
);
flags
=
RedisModule_GetC
ontex
tFlags
(
ctx
);
if
(
!
(
flags
&
REDISMODULE_CTX_FLAGS_RDB
))
FAIL
(
"RDB Flag was not set after config set"
);
...
...
@@ -168,14 +168,14 @@ int TestCtxFlags(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if
(
flags
&
REDISMODULE_CTX_FLAGS_MAXMEMORY
)
FAIL
(
"Maxmemory flag was set"
);
;
RedisModule_Call
(
ctx
,
"config"
,
"ccc"
,
"set"
,
"maxmemory"
,
"100000000"
);
flags
=
RedisModule_GetCt
x
Flags
(
ctx
);
flags
=
RedisModule_GetC
ontex
tFlags
(
ctx
);
if
(
!
(
flags
&
REDISMODULE_CTX_FLAGS_MAXMEMORY
))
FAIL
(
"Maxmemory flag was not set after config set"
);
if
(
flags
&
REDISMODULE_CTX_FLAGS_EVICT
)
FAIL
(
"Eviction flag was set"
);
RedisModule_Call
(
ctx
,
"config"
,
"ccc"
,
"set"
,
"maxmemory-policy"
,
"allkeys-lru"
);
flags
=
RedisModule_GetCt
x
Flags
(
ctx
);
flags
=
RedisModule_GetC
ontex
tFlags
(
ctx
);
if
(
!
(
flags
&
REDISMODULE_CTX_FLAGS_EVICT
))
FAIL
(
"Eviction flag was not set after config set"
);
...
...
src/redismodule.h
View file @
d131921c
...
...
@@ -58,7 +58,7 @@
#define REDISMODULE_HASH_CFIELDS (1<<2)
#define REDISMODULE_HASH_EXISTS (1<<3)
/* Context Flags: Info about the current context returned by RM_GetCt
x
Flags */
/* Context Flags: Info about the current context returned by RM_GetC
ontex
tFlags */
/* The command is running in the context of a Lua script */
#define REDISMODULE_CTX_FLAGS_LUA 0x0001
...
...
@@ -207,7 +207,7 @@ int REDISMODULE_API_FUNC(RedisModule_HashGet)(RedisModuleKey *key, int flags, ..
int
REDISMODULE_API_FUNC
(
RedisModule_IsKeysPositionRequest
)(
RedisModuleCtx
*
ctx
);
void
REDISMODULE_API_FUNC
(
RedisModule_KeyAtPos
)(
RedisModuleCtx
*
ctx
,
int
pos
);
unsigned
long
long
REDISMODULE_API_FUNC
(
RedisModule_GetClientId
)(
RedisModuleCtx
*
ctx
);
int
REDISMODULE_API_FUNC
(
RedisModule_GetCt
x
Flags
)(
RedisModuleCtx
*
ctx
);
int
REDISMODULE_API_FUNC
(
RedisModule_GetC
ontex
tFlags
)(
RedisModuleCtx
*
ctx
);
void
*
REDISMODULE_API_FUNC
(
RedisModule_PoolAlloc
)(
RedisModuleCtx
*
ctx
,
size_t
bytes
);
RedisModuleType
*
REDISMODULE_API_FUNC
(
RedisModule_CreateDataType
)(
RedisModuleCtx
*
ctx
,
const
char
*
name
,
int
encver
,
RedisModuleTypeMethods
*
typemethods
);
int
REDISMODULE_API_FUNC
(
RedisModule_ModuleTypeSetValue
)(
RedisModuleKey
*
key
,
RedisModuleType
*
mt
,
void
*
value
);
...
...
@@ -327,7 +327,7 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
REDISMODULE_GET_API
(
IsKeysPositionRequest
);
REDISMODULE_GET_API
(
KeyAtPos
);
REDISMODULE_GET_API
(
GetClientId
);
REDISMODULE_GET_API
(
GetCt
x
Flags
);
REDISMODULE_GET_API
(
GetC
ontex
tFlags
);
REDISMODULE_GET_API
(
PoolAlloc
);
REDISMODULE_GET_API
(
CreateDataType
);
REDISMODULE_GET_API
(
ModuleTypeSetValue
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment