mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Remove non semantical spaces from module.c.
This commit is contained in:
parent
7830f8492f
commit
aa57481d8c
17
src/module.c
17
src/module.c
@ -220,7 +220,8 @@ static pthread_mutex_t moduleGIL = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Function pointer type for keyspace event notification subscriptions from modules. */
|
||||
typedef int (*RedisModuleNotificationFunc) (RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key);
|
||||
|
||||
/* Keyspace notification subscriber information. See RM_SubscribeToKeyspaceEvents */
|
||||
/* Keyspace notification subscriber information.
|
||||
* See RM_SubscribeToKeyspaceEvents() for more information. */
|
||||
typedef struct RedisModuleKeyspaceSubscriber {
|
||||
/* The module subscribed to the event */
|
||||
RedisModule *module;
|
||||
@ -228,14 +229,16 @@ typedef struct RedisModuleKeyspaceSubscriber {
|
||||
RedisModuleNotificationFunc notify_callback;
|
||||
/* A bit mask of the events the module is interested in */
|
||||
int event_mask;
|
||||
/* Active flag set on entry, to avoid reentrant subscribers calling themselves */
|
||||
/* Active flag set on entry, to avoid reentrant subscribers
|
||||
* calling themselves */
|
||||
int active;
|
||||
} RedisModuleKeyspaceSubscriber;
|
||||
|
||||
/* The module keyspace notification subscribers list */
|
||||
static list *moduleKeyspaceSubscribers;
|
||||
|
||||
/* Static client recycled for all notification clients, to avoid allocating per round. */
|
||||
/* Static client recycled for all notification clients, to avoid allocating
|
||||
* per round. */
|
||||
static client *moduleKeyspaceSubscribersClient;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
@ -3754,26 +3757,22 @@ int RM_SubscribeToKeyspaceEvents(RedisModuleCtx *ctx, int types, RedisModuleNoti
|
||||
|
||||
listAddNodeTail(moduleKeyspaceSubscribers, sub);
|
||||
return REDISMODULE_OK;
|
||||
|
||||
}
|
||||
|
||||
/* Dispatcher for keyspace notifications to module subscriber functions.
|
||||
* This gets called only if at least one module requested to be notified on
|
||||
* keyspace notifications */
|
||||
void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid) {
|
||||
|
||||
/* Don't do anything if there aren't any subscribers */
|
||||
if (listLength(moduleKeyspaceSubscribers) == 0) return;
|
||||
|
||||
listIter li;
|
||||
listNode *ln;
|
||||
|
||||
listRewind(moduleKeyspaceSubscribers,&li);
|
||||
|
||||
/* Remove irrelevant flags from the type mask */
|
||||
type &= ~(NOTIFY_KEYEVENT | NOTIFY_KEYSPACE);
|
||||
|
||||
|
||||
while((ln = listNext(&li))) {
|
||||
RedisModuleKeyspaceSubscriber *sub = ln->value;
|
||||
/* Only notify subscribers on events matching they registration,
|
||||
@ -3793,7 +3792,6 @@ void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid)
|
||||
moduleFreeContext(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Unsubscribe any notification subscirbers this module has upon unloading */
|
||||
@ -3810,7 +3808,6 @@ void moduleUnsubscribeNotifications(RedisModule *module) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Modules API internals
|
||||
* -------------------------------------------------------------------------- */
|
||||
@ -3848,7 +3845,6 @@ void moduleRegisterCoreAPI(void);
|
||||
|
||||
void moduleInitModulesSystem(void) {
|
||||
moduleUnblockedClients = listCreate();
|
||||
|
||||
server.loadmodule_queue = listCreate();
|
||||
modules = dictCreate(&modulesDictType,NULL);
|
||||
|
||||
@ -3907,7 +3903,6 @@ void moduleFreeModuleStructure(struct RedisModule *module) {
|
||||
zfree(module);
|
||||
}
|
||||
|
||||
|
||||
void moduleUnregisterCommands(struct RedisModule *module) {
|
||||
/* Unregister all the commands registered by this module. */
|
||||
dictIterator *di = dictGetSafeIterator(server.commands);
|
||||
|
Loading…
x
Reference in New Issue
Block a user