Skip to content

Commit

Permalink
Cluster refactor: Some code convention fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Hershberg <[email protected]>
  • Loading branch information
Josh Hershberg committed Nov 22, 2023
1 parent 290f376 commit eebb025
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions src/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,29 @@ sds clusterGenNodeDescription(client *c, clusterNode *node, int tls_primary);
int clusterNodeCoversSlot(clusterNode *n, int slot);
int getNodeDefaultClientPort(clusterNode *n);
int clusterNodeIsMyself(clusterNode *n);
clusterNode* getMyClusterNode(void);
char* getMyClusterId(void);
clusterNode *getMyClusterNode(void);
char *getMyClusterId(void);
int getClusterSize(void);
char** getClusterNodesList(size_t *numnodes);
int handleDebugClusterCommand(client *c);
int clusterNodePending(clusterNode *node);
int clusterNodeIsMaster(clusterNode *n);
char* clusterNodeIp(clusterNode *node);
char **getClusterNodesList(size_t *numnodes);
int clusterNodeIsMaster(clusterNode *n);
char *clusterNodeIp(clusterNode *node);
int clusterNodeIsSlave(clusterNode *node);
clusterNode *clusterNodeGetSlaveof(clusterNode *node);
char* clusterNodeGetName(clusterNode *node);
char *clusterNodeGetName(clusterNode *node);
int clusterNodeTimedOut(clusterNode *node);
int clusterNodeIsFailing(clusterNode *node);
int clusterNodeIsNoFailover(clusterNode *node);
char* clusterNodeGetShardId(clusterNode *node);
char *clusterNodeGetShardId(clusterNode *node);
int clusterNodeNumSlaves(clusterNode *node);
clusterNode *clusterNodeGetSlave(clusterNode *node, int slave_idx);
clusterNode *getMigratingSlotDest(int slot);
clusterNode *getImportingSlotSource(int slot);
clusterNode *getNodeBySlot(int slot);
int clusterNodeClientPort(clusterNode *n, int use_tls);
char* clusterNodeHostname(clusterNode *node);
char *clusterNodeHostname(clusterNode *node);
const char *clusterNodePreferredEndpoint(clusterNode *n);
long long clusterNodeReplOffset(clusterNode *node);
clusterNode *clusterLookupNode(const char *name, int length);
Expand Down
14 changes: 7 additions & 7 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -5761,7 +5761,7 @@ int clusterNodeIsMyself(clusterNode *n) {
return n == server.cluster->myself;
}

clusterNode* getMyClusterNode(void) {
clusterNode *getMyClusterNode(void) {
return server.cluster->myself;
}

Expand All @@ -5773,7 +5773,7 @@ int getClusterSize(void) {
return dictSize(server.cluster->nodes);
}

char** getClusterNodesList(size_t *numnodes) {
char **getClusterNodesList(size_t *numnodes) {
size_t count = dictSize(server.cluster->nodes);
char **ids = zmalloc((count+1)*CLUSTER_NAMELEN);
dictIterator *di = dictGetIterator(server.cluster->nodes);
Expand Down Expand Up @@ -5836,7 +5836,7 @@ int clusterNodePending(clusterNode *node) {
return node->flags & (CLUSTER_NODE_NOADDR|CLUSTER_NODE_HANDSHAKE);
}

char* clusterNodeIp(clusterNode *node) {
char *clusterNodeIp(clusterNode *node) {
return node->ip;
}

Expand All @@ -5848,7 +5848,7 @@ clusterNode *clusterNodeGetSlaveof(clusterNode *node) {
return node->slaveof;
}

char* clusterNodeGetName(clusterNode *node) {
char *clusterNodeGetName(clusterNode *node) {
return node->name;
}

Expand All @@ -5874,7 +5874,7 @@ const char **clusterDebugCommandExtendedHelp(void) {
return help;
}

char* clusterNodeGetShardId(clusterNode *node) {
char *clusterNodeGetShardId(clusterNode *node) {
return node->shard_id;
}

Expand Down Expand Up @@ -6326,7 +6326,7 @@ int clusterCommandSpecial(client *c) {
return 1;
}

const char** clusterCommandExtendedHelp(void) {
const char **clusterCommandExtendedHelp(void) {
static const char *help[] = {
"ADDSLOTS <slot> [<slot> ...]",
" Assign slots to current node.",
Expand Down Expand Up @@ -6391,7 +6391,7 @@ clusterNode *getNodeBySlot(int slot) {
return server.cluster->slots[slot];
}

char* clusterNodeHostname(clusterNode *node) {
char *clusterNodeHostname(clusterNode *node) {
return node->hostname;
}

Expand Down

0 comments on commit eebb025

Please sign in to comment.