rename channel to shardchannel in sharded pubsub commands (#10738)
since the sharded pubsub is different with pubsub, it's better to give users a hint to make it more clear.
This commit is contained in:
parent
bb1de082ea
commit
805191c791
@ -3160,7 +3160,7 @@ struct redisCommandArg PUBSUB_SHARDCHANNELS_Args[] = {
|
||||
|
||||
/* PUBSUB SHARDNUMSUB argument table */
|
||||
struct redisCommandArg PUBSUB_SHARDNUMSUB_Args[] = {
|
||||
{"channel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE},
|
||||
{"shardchannel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -3170,8 +3170,8 @@ struct redisCommand PUBSUB_Subcommands[] = {
|
||||
{"help","Show helpful text about the different subcommands","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_HELP_History,PUBSUB_HELP_tips,pubsubCommand,2,CMD_LOADING|CMD_STALE,0},
|
||||
{"numpat","Get the count of unique patterns pattern subscriptions","O(1)","2.8.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_NUMPAT_History,PUBSUB_NUMPAT_tips,pubsubCommand,2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0},
|
||||
{"numsub","Get the count of subscribers for channels","O(N) for the NUMSUB subcommand, where N is the number of requested channels","2.8.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_NUMSUB_History,PUBSUB_NUMSUB_tips,pubsubCommand,-2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0,.args=PUBSUB_NUMSUB_Args},
|
||||
{"shardchannels","List active shard channels","O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short channels).","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_SHARDCHANNELS_History,PUBSUB_SHARDCHANNELS_tips,pubsubCommand,-2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0,.args=PUBSUB_SHARDCHANNELS_Args},
|
||||
{"shardnumsub","Get the count of subscribers for shard channels","O(N) for the SHARDNUMSUB subcommand, where N is the number of requested channels","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_SHARDNUMSUB_History,PUBSUB_SHARDNUMSUB_tips,pubsubCommand,-2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0,.args=PUBSUB_SHARDNUMSUB_Args},
|
||||
{"shardchannels","List active shard channels","O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels).","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_SHARDCHANNELS_History,PUBSUB_SHARDCHANNELS_tips,pubsubCommand,-2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0,.args=PUBSUB_SHARDCHANNELS_Args},
|
||||
{"shardnumsub","Get the count of subscribers for shard channels","O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,PUBSUB_SHARDNUMSUB_History,PUBSUB_SHARDNUMSUB_tips,pubsubCommand,-2,CMD_PUBSUB|CMD_LOADING|CMD_STALE,0,.args=PUBSUB_SHARDNUMSUB_Args},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -3207,7 +3207,7 @@ struct redisCommandArg PUNSUBSCRIBE_Args[] = {
|
||||
|
||||
/* SPUBLISH argument table */
|
||||
struct redisCommandArg SPUBLISH_Args[] = {
|
||||
{"channel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE},
|
||||
{"shardchannel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE},
|
||||
{"message",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE},
|
||||
{0}
|
||||
};
|
||||
@ -3222,7 +3222,7 @@ struct redisCommandArg SPUBLISH_Args[] = {
|
||||
|
||||
/* SSUBSCRIBE argument table */
|
||||
struct redisCommandArg SSUBSCRIBE_Args[] = {
|
||||
{"channel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE},
|
||||
{"shardchannel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -3250,7 +3250,7 @@ struct redisCommandArg SUBSCRIBE_Args[] = {
|
||||
|
||||
/* SUNSUBSCRIBE argument table */
|
||||
struct redisCommandArg SUNSUBSCRIBE_Args[] = {
|
||||
{"channel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE},
|
||||
{"shardchannel",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -7274,7 +7274,7 @@ struct redisCommand redisCommandTable[] = {
|
||||
{"spublish","Post a message to a shard channel","O(N) where N is the number of clients subscribed to the receiving shard channel.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,SPUBLISH_History,SPUBLISH_tips,spublishCommand,3,CMD_PUBSUB|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_MAY_REPLICATE,0,{{NULL,CMD_KEY_NOT_KEY,KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={0,1,0}}},.args=SPUBLISH_Args},
|
||||
{"ssubscribe","Listen for messages published to the given shard channels","O(N) where N is the number of shard channels to subscribe to.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,SSUBSCRIBE_History,SSUBSCRIBE_tips,ssubscribeCommand,-2,CMD_PUBSUB|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,0,{{NULL,CMD_KEY_NOT_KEY,KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={-1,1,0}}},.args=SSUBSCRIBE_Args},
|
||||
{"subscribe","Listen for messages published to the given channels","O(N) where N is the number of channels to subscribe to.","2.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,SUBSCRIBE_History,SUBSCRIBE_tips,subscribeCommand,-2,CMD_PUBSUB|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,0,.args=SUBSCRIBE_Args},
|
||||
{"sunsubscribe","Stop listening for messages posted to the given shard channels","O(N) where N is the number of clients already subscribed to a channel.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,SUNSUBSCRIBE_History,SUNSUBSCRIBE_tips,sunsubscribeCommand,-1,CMD_PUBSUB|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,0,{{NULL,CMD_KEY_NOT_KEY,KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={-1,1,0}}},.args=SUNSUBSCRIBE_Args},
|
||||
{"sunsubscribe","Stop listening for messages posted to the given shard channels","O(N) where N is the number of clients already subscribed to a shard channel.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,SUNSUBSCRIBE_History,SUNSUBSCRIBE_tips,sunsubscribeCommand,-1,CMD_PUBSUB|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,0,{{NULL,CMD_KEY_NOT_KEY,KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={-1,1,0}}},.args=SUNSUBSCRIBE_Args},
|
||||
{"unsubscribe","Stop listening for messages posted to the given channels","O(N) where N is the number of clients already subscribed to a channel.","2.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_PUBSUB,UNSUBSCRIBE_History,UNSUBSCRIBE_tips,unsubscribeCommand,-1,CMD_PUBSUB|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,0,.args=UNSUBSCRIBE_Args},
|
||||
/* scripting */
|
||||
{"eval","Execute a Lua script server side","Depends on the script that is executed.","2.6.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,EVAL_History,EVAL_tips,evalCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_MAY_REPLICATE|CMD_NO_MANDATORY_KEYS|CMD_STALE,ACL_CATEGORY_SCRIPTING,{{"We cannot tell how the keys will be used so we assume the worst, RW and UPDATE",CMD_KEY_RW|CMD_KEY_ACCESS|CMD_KEY_UPDATE,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},evalGetKeys,.args=EVAL_Args},
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"SHARDCHANNELS": {
|
||||
"summary": "List active shard channels",
|
||||
"complexity": "O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short channels).",
|
||||
"complexity": "O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels).",
|
||||
"group": "pubsub",
|
||||
"since": "7.0.0",
|
||||
"arity": -2,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"SHARDNUMSUB": {
|
||||
"summary": "Get the count of subscribers for shard channels",
|
||||
"complexity": "O(N) for the SHARDNUMSUB subcommand, where N is the number of requested channels",
|
||||
"complexity": "O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels",
|
||||
"group": "pubsub",
|
||||
"since": "7.0.0",
|
||||
"arity": -2,
|
||||
@ -14,7 +14,7 @@
|
||||
],
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel",
|
||||
"name": "shardchannel",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"multiple": true
|
||||
|
@ -15,7 +15,7 @@
|
||||
],
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel",
|
||||
"name": "shardchannel",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
],
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel",
|
||||
"name": "shardchannel",
|
||||
"type": "string",
|
||||
"multiple": true
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"SUNSUBSCRIBE": {
|
||||
"summary": "Stop listening for messages posted to the given shard channels",
|
||||
"complexity": "O(N) where N is the number of clients already subscribed to a channel.",
|
||||
"complexity": "O(N) where N is the number of clients already subscribed to a shard channel.",
|
||||
"group": "pubsub",
|
||||
"since": "7.0.0",
|
||||
"arity": -1,
|
||||
@ -14,7 +14,7 @@
|
||||
],
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel",
|
||||
"name": "shardchannel",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"multiple": true
|
||||
|
12
src/pubsub.c
12
src/pubsub.c
@ -607,10 +607,10 @@ void pubsubCommand(client *c) {
|
||||
" Return number of subscriptions to patterns.",
|
||||
"NUMSUB [<channel> ...]",
|
||||
" Return the number of subscribers for the specified channels, excluding",
|
||||
" pattern subscriptions(default: no channels)."
|
||||
" pattern subscriptions(default: no channels).",
|
||||
"SHARDCHANNELS [<pattern>]",
|
||||
" Return the currently active shard level channels matching a <pattern> (default: '*').",
|
||||
"SHARDNUMSUB [<channel> ...]",
|
||||
"SHARDNUMSUB [<shardchannel> ...]",
|
||||
" Return the number of subscribers for the specified shard level channel(s)",
|
||||
NULL
|
||||
};
|
||||
@ -642,7 +642,7 @@ NULL
|
||||
sds pat = (c->argc == 2) ? NULL : c->argv[2]->ptr;
|
||||
channelList(c,pat,server.pubsubshard_channels);
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"shardnumsub") && c->argc >= 2) {
|
||||
/* PUBSUB SHARDNUMSUB [Channel_1 ... Channel_N] */
|
||||
/* PUBSUB SHARDNUMSUB [ShardChannel_1 ... ShardChannel_N] */
|
||||
int j;
|
||||
|
||||
addReplyArrayLen(c, (c->argc-2)*2);
|
||||
@ -679,7 +679,7 @@ void channelList(client *c, sds pat, dict *pubsub_channels) {
|
||||
setDeferredArrayLen(c,replylen,mblen);
|
||||
}
|
||||
|
||||
/* SPUBLISH <channel> <message> */
|
||||
/* SPUBLISH <shardchannel> <message> */
|
||||
void spublishCommand(client *c) {
|
||||
int receivers = pubsubPublishMessageAndPropagateToCluster(c->argv[1],c->argv[2],1);
|
||||
if (!server.cluster_enabled)
|
||||
@ -687,7 +687,7 @@ void spublishCommand(client *c) {
|
||||
addReplyLongLong(c,receivers);
|
||||
}
|
||||
|
||||
/* SSUBSCRIBE channel [channel ...] */
|
||||
/* SSUBSCRIBE shardchannel [shardchannel ...] */
|
||||
void ssubscribeCommand(client *c) {
|
||||
if (c->flags & CLIENT_DENY_BLOCKING) {
|
||||
/* A client that has CLIENT_DENY_BLOCKING flag on
|
||||
@ -711,7 +711,7 @@ void ssubscribeCommand(client *c) {
|
||||
}
|
||||
|
||||
|
||||
/* SUNSUBSCRIBE [channel [channel ...]] */
|
||||
/* SUNSUBSCRIBE [shardchannel [shardchannel ...]] */
|
||||
void sunsubscribeCommand(client *c) {
|
||||
if (c->argc == 1) {
|
||||
pubsubUnsubscribeShardAllChannels(c, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user