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

Function clusterSendModuleMessageToTarget

src/cluster.cpp:2876–2887  ·  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

2874 * The function returns C_OK if the target is valid, otherwise C_ERR is
2875 * returned. */
2876int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) {
2877 clusterNode *node = NULL;
2878
2879 if (target != NULL) {
2880 node = clusterLookupNode(target);
2881 if (node == NULL || node->link == NULL) return C_ERR;
2882 }
2883
2884 clusterSendModule(target ? node->link : NULL,
2885 module_id, type, payload, len);
2886 return C_OK;
2887}
2888
2889/* -----------------------------------------------------------------------------
2890 * CLUSTER Pub/Sub support

Callers 1

RM_SendClusterMessageFunction · 0.85

Calls 2

clusterLookupNodeFunction · 0.85
clusterSendModuleFunction · 0.85

Tested by

no test coverage detected