summaryrefslogtreecommitdiff
path: root/src/notify.c
diff options
context:
space:
mode:
authorHanna Fadida <hanna.fadida@redislabs.com>2021-04-19 21:33:26 +0300
committerGitHub <noreply@github.com>2021-04-19 21:33:26 +0300
commit53a4d6c3b152a9aa6386c2362400b258cec09ed3 (patch)
tree7ab3ed530bc67cf90d2f8a2ed504f52b043dc243 /src/notify.c
parentf40ca9cb58049683b563245006892001a5ebfacd (diff)
downloadredis-53a4d6c3b152a9aa6386c2362400b258cec09ed3.tar.gz
Modules: adding a module type for key space notification (#8759)
Adding a new type mask ​for key space notification, REDISMODULE_NOTIFY_MODULE, to enable unique notifications from commands on REDISMODULE_KEYTYPE_MODULE type keys (which is currently unsupported). Modules can subscribe to a module key keyspace notification by RM_SubscribeToKeyspaceEvents, and clients by notify-keyspace-events of redis.conf or via the CONFIG SET, with the characters 'd' or 'A' (REDISMODULE_NOTIFY_MODULE type mask is part of the '**A**ll' notation for key space notifications). Refactor: move some pubsub test infra from pubsub.tcl to util.tcl to be re-used by other tests.
Diffstat (limited to 'src/notify.c')
-rw-r--r--src/notify.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/notify.c b/src/notify.c
index 5c7634bce..afaddbfca 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -56,6 +56,7 @@ int keyspaceEventsStringToFlags(char *classes) {
case 'E': flags |= NOTIFY_KEYEVENT; break;
case 't': flags |= NOTIFY_STREAM; break;
case 'm': flags |= NOTIFY_KEY_MISS; break;
+ case 'd': flags |= NOTIFY_MODULE; break;
default: return -1;
}
}
@@ -82,6 +83,7 @@ sds keyspaceEventsFlagsToString(int flags) {
if (flags & NOTIFY_EXPIRED) res = sdscatlen(res,"x",1);
if (flags & NOTIFY_EVICTED) res = sdscatlen(res,"e",1);
if (flags & NOTIFY_STREAM) res = sdscatlen(res,"t",1);
+ if (flags & NOTIFY_MODULE) res = sdscatlen(res,"d",1);
}
if (flags & NOTIFY_KEYSPACE) res = sdscatlen(res,"K",1);
if (flags & NOTIFY_KEYEVENT) res = sdscatlen(res,"E",1);