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
646c958b
Commit
646c958b
authored
May 10, 2016
by
antirez
Browse files
Modules: doc layout improved.
parent
745845df
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
src/module.c
View file @
646c958b
...
@@ -451,7 +451,7 @@ int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc c
...
@@ -451,7 +451,7 @@ int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc c
return
REDISMODULE_OK
;
return
REDISMODULE_OK
;
}
}
/* Called by RM_Init() to setup the ctx->module structure.
/* Called by RM_Init() to setup the
`
ctx->module
`
structure.
*
*
* This is an internal function, Redis modules developers don't need
* This is an internal function, Redis modules developers don't need
* to use it. */
* to use it. */
...
@@ -578,7 +578,7 @@ const char *RM_StringPtrLen(RedisModuleString *str, size_t *len) {
...
@@ -578,7 +578,7 @@ const char *RM_StringPtrLen(RedisModuleString *str, size_t *len) {
return
str
->
ptr
;
return
str
->
ptr
;
}
}
/* Convert the string into a long long integer, storing it at *ll.
/* Convert the string into a long long integer, storing it at
`
*ll
`
.
* Returns REDISMODULE_OK on success. If the string can't be parsed
* Returns REDISMODULE_OK on success. If the string can't be parsed
* as a valid, strict long long (no spaces before/after), REDISMODULE_ERR
* as a valid, strict long long (no spaces before/after), REDISMODULE_ERR
* is returned. */
* is returned. */
...
@@ -587,7 +587,7 @@ int RM_StringToLongLong(RedisModuleString *str, long long *ll) {
...
@@ -587,7 +587,7 @@ int RM_StringToLongLong(RedisModuleString *str, long long *ll) {
REDISMODULE_ERR
;
REDISMODULE_ERR
;
}
}
/* Convert the string into a double, storing it at *d.
/* Convert the string into a double, storing it at
`
*d
`
.
* Returns REDISMODULE_OK on success or REDISMODULE_ERR if the string is
* Returns REDISMODULE_OK on success or REDISMODULE_ERR if the string is
* not a valid string representation of a double value. */
* not a valid string representation of a double value. */
int
RM_StringToDouble
(
RedisModuleString
*
str
,
double
*
d
)
{
int
RM_StringToDouble
(
RedisModuleString
*
str
,
double
*
d
)
{
...
@@ -665,7 +665,7 @@ int RM_ReplyWithSimpleString(RedisModuleCtx *ctx, const char *msg) {
...
@@ -665,7 +665,7 @@ int RM_ReplyWithSimpleString(RedisModuleCtx *ctx, const char *msg) {
}
}
/* Reply with an array type of 'len' elements. However 'len' other calls
/* Reply with an array type of 'len' elements. However 'len' other calls
* to ReplyWith* style functions must follow in order to emit the elements
* to
`
ReplyWith*
`
style functions must follow in order to emit the elements
* of the array.
* of the array.
*
*
* When producing arrays with a number of element that is not known beforehand
* When producing arrays with a number of element that is not known beforehand
...
@@ -1219,9 +1219,9 @@ int RM_ZsetAddFlagsFromCoreFlags(int flags) {
...
@@ -1219,9 +1219,9 @@ int RM_ZsetAddFlagsFromCoreFlags(int flags) {
* On success the function returns REDISMODULE_OK. On the following errors
* On success the function returns REDISMODULE_OK. On the following errors
* REDISMODULE_ERR is returned:
* REDISMODULE_ERR is returned:
*
*
*
-
The key was not opened for writing.
*
*
The key was not opened for writing.
*
-
The key is of the wrong type.
*
*
The key is of the wrong type.
*
-
'score' double value is not a number (NaN).
*
*
'score' double value is not a number (NaN).
*/
*/
int
RM_ZsetAdd
(
RedisModuleKey
*
key
,
double
score
,
RedisModuleString
*
ele
,
int
*
flagsptr
)
{
int
RM_ZsetAdd
(
RedisModuleKey
*
key
,
double
score
,
RedisModuleString
*
ele
,
int
*
flagsptr
)
{
int
flags
=
0
;
int
flags
=
0
;
...
@@ -1274,8 +1274,8 @@ int RM_ZsetIncrby(RedisModuleKey *key, double score, RedisModuleString *ele, int
...
@@ -1274,8 +1274,8 @@ int RM_ZsetIncrby(RedisModuleKey *key, double score, RedisModuleString *ele, int
* The function returns REDISMODULE_OK on success, and REDISMODULE_ERR
* The function returns REDISMODULE_OK on success, and REDISMODULE_ERR
* on one of the following conditions:
* on one of the following conditions:
*
*
*
-
The key was not opened for writing.
*
*
The key was not opened for writing.
*
-
The key is of the wrong type.
*
*
The key is of the wrong type.
*
*
* The return value does NOT indicate the fact the element was really
* The return value does NOT indicate the fact the element was really
* removed (since it existed) or not, just if the function was executed
* removed (since it existed) or not, just if the function was executed
...
@@ -1303,9 +1303,9 @@ int RM_ZsetRem(RedisModuleKey *key, RedisModuleString *ele, int *deleted) {
...
@@ -1303,9 +1303,9 @@ int RM_ZsetRem(RedisModuleKey *key, RedisModuleString *ele, int *deleted) {
* 'ele' and returns REDISMODULE_OK. Otherwise REDISMODULE_ERR is returned
* 'ele' and returns REDISMODULE_OK. Otherwise REDISMODULE_ERR is returned
* to signal one of the following conditions:
* to signal one of the following conditions:
*
*
*
-
There is no such element 'ele' in the sorted set.
*
*
There is no such element 'ele' in the sorted set.
*
-
The key is not a sorted set.
*
*
The key is not a sorted set.
*
-
The key is an open empty key.
*
*
The key is an open empty key.
*/
*/
int
RM_ZsetScore
(
RedisModuleKey
*
key
,
RedisModuleString
*
ele
,
double
*
score
)
{
int
RM_ZsetScore
(
RedisModuleKey
*
key
,
RedisModuleString
*
ele
,
double
*
score
)
{
if
(
key
->
value
==
NULL
)
return
REDISMODULE_ERR
;
if
(
key
->
value
==
NULL
)
return
REDISMODULE_ERR
;
...
@@ -1663,8 +1663,8 @@ int RM_ZsetRangePrev(RedisModuleKey *key) {
...
@@ -1663,8 +1663,8 @@ int RM_ZsetRangePrev(RedisModuleKey *key) {
*
*
* In the following case the return value is always zero:
* In the following case the return value is always zero:
*
*
*
-
The key was not open for writing.
*
*
The key was not open for writing.
*
-
The key was associated with a non Hash value.
*
*
The key was associated with a non Hash value.
*/
*/
int
RM_HashSet
(
RedisModuleKey
*
key
,
int
flags
,
...)
{
int
RM_HashSet
(
RedisModuleKey
*
key
,
int
flags
,
...)
{
va_list
ap
;
va_list
ap
;
...
...
src/modules/API.md
View file @
646c958b
This diff is collapsed.
Click to expand it.
src/modules/INTRO.md
0 → 100644
View file @
646c958b
This diff is collapsed.
Click to expand it.
src/modules/gendoc.rb
View file @
646c958b
...
@@ -6,6 +6,11 @@ def markdown(s)
...
@@ -6,6 +6,11 @@ def markdown(s)
s
=
s
.
gsub
(
/\*\/$/
,
""
)
s
=
s
.
gsub
(
/\*\/$/
,
""
)
s
=
s
.
gsub
(
/^ \* {0,1}/
,
""
)
s
=
s
.
gsub
(
/^ \* {0,1}/
,
""
)
s
=
s
.
gsub
(
/^\/\* /
,
""
)
s
=
s
.
gsub
(
/^\/\* /
,
""
)
if
s
[
0
]
!=
' '
s
=
s
.
gsub
(
/RM_[A-z()]+/
){
|
x
|
"`
#{
x
}
`"
}
s
=
s
.
gsub
(
/RedisModule_[A-z()]+/
){
|
x
|
"`
#{
x
}
`"
}
s
=
s
.
gsub
(
/REDISMODULE_[A-z]+/
){
|
x
|
"`
#{
x
}
`"
}
end
s
.
chop!
while
s
[
-
1
]
==
"
\n
"
||
s
[
-
1
]
==
" "
s
.
chop!
while
s
[
-
1
]
==
"
\n
"
||
s
[
-
1
]
==
" "
return
s
return
s
end
end
...
@@ -15,7 +20,7 @@ end
...
@@ -15,7 +20,7 @@ end
def
docufy
(
src
,
i
)
def
docufy
(
src
,
i
)
m
=
/RM_[A-z0-9]+/
.
match
(
src
[
i
])
m
=
/RM_[A-z0-9]+/
.
match
(
src
[
i
])
proto
=
src
[
i
].
sub
(
"{"
,
""
).
strip
+
";
\n
"
proto
=
src
[
i
].
sub
(
"{"
,
""
).
strip
+
";
\n
"
puts
"##
#{
m
[
0
]
}
\n\n
"
puts
"##
`
#{
m
[
0
]
}
`
\n\n
"
puts
"
#{
proto
}
\n
"
puts
"
#{
proto
}
\n
"
comment
=
""
comment
=
""
while
true
while
true
...
...
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