diff options
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/server.h b/src/server.h index 792eb30a1..c1a0af355 100644 --- a/src/server.h +++ b/src/server.h @@ -233,9 +233,12 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; /* Key argument flags. Please check the command table defined in the server.c file * for more information about the meaning of every flag. */ -#define CMD_KEY_WRITE (1ULL<<0) -#define CMD_KEY_READ (1ULL<<1) -#define CMD_KEY_INCOMPLETE (1ULL<<2) /* meaning that the keyspec might not point out to all keys it should cover */ +#define CMD_KEY_WRITE (1ULL<<0) /* "write" flag */ +#define CMD_KEY_READ (1ULL<<1) /* "read" flag */ +#define CMD_KEY_SHARD_CHANNEL (1ULL<<2) /* "shard_channel" flag */ +#define CMD_KEY_INCOMPLETE (1ULL<<3) /* "incomplete" flag (meaning that + * the keyspec might not point out + * to all keys it should cover) */ /* AOF states */ #define AOF_OFF 0 /* AOF is off */ @@ -1086,6 +1089,7 @@ typedef struct client { list *watched_keys; /* Keys WATCHED for MULTI/EXEC CAS */ dict *pubsub_channels; /* channels a client is interested in (SUBSCRIBE) */ list *pubsub_patterns; /* patterns a client is interested in (SUBSCRIBE) */ + dict *pubsubshard_channels; /* shard level channels a client is interested in (SSUBSCRIBE) */ sds peerid; /* Cached peer ID. */ sds sockname; /* Cached connection target address. */ listNode *client_list_node; /* list node in client list */ @@ -1174,6 +1178,7 @@ struct sharedObjectsStruct { *time, *pxat, *absttl, *retrycount, *force, *justid, *lastid, *ping, *setid, *keepttl, *load, *createconsumer, *getack, *special_asterick, *special_equals, *default_username, *redacted, + *ssubscribebulk,*sunsubscribebulk, *select[PROTO_SHARED_SELECT_CMDS], *integers[OBJ_SHARED_INTEGERS], *mbulkhdr[OBJ_SHARED_BULKHDR_LEN], /* "*<value>\r\n" */ @@ -1751,6 +1756,7 @@ struct redisServer { dict *pubsub_patterns; /* A dict of pubsub_patterns */ int notify_keyspace_events; /* Events to propagate via Pub/Sub. This is an xor of NOTIFY_... flags. */ + dict *pubsubshard_channels; /* Map channels to list of subscribed clients */ /* Cluster */ int cluster_enabled; /* Is cluster enabled? */ int cluster_port; /* Set the cluster port for a node. */ @@ -1821,6 +1827,8 @@ struct redisServer { * failover then any replica can be used. */ int target_replica_port; /* Failover target port */ int failover_state; /* Failover state */ + int cluster_allow_pubsubshard_when_down; /* Is pubsubshard allowed when the cluster + is down, doesn't affect pubsub global. */ }; #define MAX_KEYS_BUFFER 256 @@ -2816,9 +2824,14 @@ robj *hashTypeDup(robj *o); /* Pub / Sub */ int pubsubUnsubscribeAllChannels(client *c, int notify); +int pubsubUnsubscribeShardAllChannels(client *c, int notify); +void pubsubUnsubscribeShardChannels(robj **channels, unsigned int count); int pubsubUnsubscribeAllPatterns(client *c, int notify); int pubsubPublishMessage(robj *channel, robj *message); +int pubsubPublishMessageShard(robj *channel, robj *message); void addReplyPubsubMessage(client *c, robj *channel, robj *msg); +int serverPubsubSubscriptionCount(); +int serverPubsubShardSubscriptionCount(); /* Keyspace events notification */ void notifyKeyspaceEvent(int type, char *event, robj *key, int dbid); @@ -2902,6 +2915,7 @@ void freeReplicationBacklogRefMemAsync(list *blocks, rax *index); /* API to get key arguments from commands */ int *getKeysPrepareResult(getKeysResult *result, int numkeys); int getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); +int getChannelsFromCommand(struct redisCommand *cmd, int argc, getKeysResult *result); void getKeysFreeResult(getKeysResult *result); int sintercardGetKeys(struct redisCommand *cmd,robj **argv, int argc, getKeysResult *result); int zunionInterDiffGetKeys(struct redisCommand *cmd,robj **argv, int argc, getKeysResult *result); @@ -3184,6 +3198,9 @@ void psubscribeCommand(client *c); void punsubscribeCommand(client *c); void publishCommand(client *c); void pubsubCommand(client *c); +void spublishCommand(client *c); +void ssubscribeCommand(client *c); +void sunsubscribeCommand(client *c); void watchCommand(client *c); void unwatchCommand(client *c); void clusterCommand(client *c); |