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

Function createClusterNode

src/redis-benchmark.cpp:1072–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070/* Cluster helper functions. */
1071
1072static clusterNode *createClusterNode(char *ip, int port) {
1073 clusterNode *node = (clusterNode*)zmalloc(sizeof(*node), MALLOC_LOCAL);
1074 if (!node) return NULL;
1075 node->ip = ip;
1076 node->port = port;
1077 node->name = NULL;
1078 node->flags = 0;
1079 node->replicate = NULL;
1080 node->replicas_count = 0;
1081 node->slots = (int*)zmalloc(CLUSTER_SLOTS * sizeof(int), MALLOC_LOCAL);
1082 node->slots_count = 0;
1083 node->current_slot_index = 0;
1084 node->updated_slots = NULL;
1085 node->updated_slots_count = 0;
1086 node->migrating = NULL;
1087 node->importing = NULL;
1088 node->migrating_count = 0;
1089 node->importing_count = 0;
1090 node->redis_config = NULL;
1091 return node;
1092}
1093
1094static void freeClusterNode(clusterNode *node) {
1095 int i;

Callers 1

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected