MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterSendModuleMessageToTarget

Function clusterSendModuleMessageToTarget

app/redis-6.2.6/src/cluster.c:2818–2829  ·  view source on GitHub ↗

This function gets a cluster node ID string as target, the same way the nodes * addresses are represented in the modules side, resolves the node, and sends * the message. If the target is NULL the message is broadcasted. * * The function returns C_OK if the target is valid, otherwise C_ERR is * returned. */

Source from the content-addressed store, hash-verified

2816 * The function returns C_OK if the target is valid, otherwise C_ERR is
2817 * returned. */
2818int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) {
2819 clusterNode *node = NULL;
2820
2821 if (target != NULL) {
2822 node = clusterLookupNode(target);
2823 if (node == NULL || node->link == NULL) return C_ERR;
2824 }
2825
2826 clusterSendModule(target ? node->link : NULL,
2827 module_id, type, payload, len);
2828 return C_OK;
2829}
2830
2831/* -----------------------------------------------------------------------------
2832 * CLUSTER Pub/Sub support

Callers 1

RM_SendClusterMessageFunction · 0.85

Calls 2

clusterLookupNodeFunction · 0.85
clusterSendModuleFunction · 0.85

Tested by

no test coverage detected