Skip to content

Commit c8ae90f

Browse files
committed
Modules: reformat RM_Scan() top comment a bit.
1 parent 8a3e9a6 commit c8ae90f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/module.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6526,24 +6526,32 @@ void RM_ScanCursorDestroy(RedisModuleScanCursor *cursor) {
65266526
zfree(cursor);
65276527
}
65286528

6529-
/* Scan api that allows a module to scan all the keys and value in the selected db.
6529+
/* Scan API that allows a module to scan all the keys and value in
6530+
* the selected db.
65306531
*
65316532
* Callback for scan implementation.
6532-
* void scan_callback(RedisModuleCtx *ctx, RedisModuleString *keyname, RedisModuleKey *key, void *privdata);
6533-
* - ctx - the redis module context provided to for the scan.
6534-
* - keyname - owned by the caller and need to be retained if used after this function.
6535-
* - key - holds info on the key and value, it is provided as best effort, in some cases it might
6536-
* be NULL, in which case the user should (can) use RedisModule_OpenKey (and CloseKey too).
6537-
* when it is provided, it is owned by the caller and will be free when the callback returns.
6538-
* - privdata - the user data provided to RedisModule_Scan.
6533+
* void scan_callback(RedisModuleCtx *ctx, RedisModuleString *keyname,
6534+
* RedisModuleKey *key, void *privdata);
6535+
* ctx - the redis module context provided to for the scan.
6536+
* keyname - owned by the caller and need to be retained if used after this
6537+
* function.
6538+
*
6539+
* key - holds info on the key and value, it is provided as best effort, in
6540+
* some cases it might be NULL, in which case the user should (can) use
6541+
* RedisModule_OpenKey (and CloseKey too).
6542+
* when it is provided, it is owned by the caller and will be free when the
6543+
* callback returns.
6544+
*
6545+
* privdata - the user data provided to RedisModule_Scan.
65396546
*
65406547
* The way it should be used:
65416548
* RedisModuleCursor *c = RedisModule_ScanCursorCreate();
65426549
* while(RedisModule_Scan(ctx, c, callback, privateData));
65436550
* RedisModule_ScanCursorDestroy(c);
65446551
*
6545-
* It is also possible to use this API from another thread while the lock is acquired durring
6546-
* the actuall call to RM_Scan:
6552+
* It is also possible to use this API from another thread while the lock
6553+
* is acquired durring the actuall call to RM_Scan:
6554+
*
65476555
* RedisModuleCursor *c = RedisModule_ScanCursorCreate();
65486556
* RedisModule_ThreadSafeContextLock(ctx);
65496557
* while(RedisModule_Scan(ctx, c, callback, privateData)){
@@ -6553,8 +6561,9 @@ void RM_ScanCursorDestroy(RedisModuleScanCursor *cursor) {
65536561
* }
65546562
* RedisModule_ScanCursorDestroy(c);
65556563
*
6556-
* The function will return 1 if there are more elements to scan and 0 otherwise,
6557-
* possibly setting errno if the call failed.
6564+
* The function will return 1 if there are more elements to scan and
6565+
* 0 otherwise, possibly setting errno if the call failed.
6566+
*
65586567
* It is also possible to restart and existing cursor using RM_CursorRestart.
65596568
*
65606569
* IMPORTANT: This API is very similar to the Redis SCAN command from the

0 commit comments

Comments
 (0)