MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_SendClusterMessage

Function RM_SendClusterMessage

src/module.cpp:6252–6259  ·  view source on GitHub ↗

Send a message to all the nodes in the cluster if `target` is NULL, otherwise * at the specified target, which is a REDISMODULE_NODE_ID_LEN bytes node ID, as * returned by the receiver callback or by the nodes iteration functions. * * The function returns REDISMODULE_OK if the message was successfully sent, * otherwise if the node is not connected or such node ID does not map to any * known

Source from the content-addressed store, hash-verified

6250 * otherwise if the node is not connected or such node ID does not map to any
6251 * known cluster node, REDISMODULE_ERR is returned. */
6252int RM_SendClusterMessage(RedisModuleCtx *ctx, char *target_id, uint8_t type, unsigned char *msg, uint32_t len) {
6253 if (!g_pserver->cluster_enabled) return REDISMODULE_ERR;
6254 uint64_t module_id = moduleTypeEncodeId(ctx->module->name,0);
6255 if (clusterSendModuleMessageToTarget(target_id,module_id,type,msg,len) == C_OK)
6256 return REDISMODULE_OK;
6257 else
6258 return REDISMODULE_ERR;
6259}
6260
6261/* Return an array of string pointers, each string pointer points to a cluster
6262 * node ID of exactly REDISMODULE_NODE_ID_SIZE bytes (without any null term).

Callers

nothing calls this directly

Calls 2

moduleTypeEncodeIdFunction · 0.85

Tested by

no test coverage detected