mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Modules Cluster API: make node IDs pointers constant.
This commit is contained in:
parent
061f03d730
commit
a97df1a6e1
@ -56,7 +56,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request);
|
|||||||
void clusterUpdateState(void);
|
void clusterUpdateState(void);
|
||||||
int clusterNodeGetSlotBit(clusterNode *n, int slot);
|
int clusterNodeGetSlotBit(clusterNode *n, int slot);
|
||||||
sds clusterGenNodesDescription(int filter);
|
sds clusterGenNodesDescription(int filter);
|
||||||
clusterNode *clusterLookupNode(char *name);
|
clusterNode *clusterLookupNode(const char *name);
|
||||||
int clusterNodeAddSlave(clusterNode *master, clusterNode *slave);
|
int clusterNodeAddSlave(clusterNode *master, clusterNode *slave);
|
||||||
int clusterAddSlot(clusterNode *n, int slot);
|
int clusterAddSlot(clusterNode *n, int slot);
|
||||||
int clusterDelSlot(int slot);
|
int clusterDelSlot(int slot);
|
||||||
@ -75,7 +75,7 @@ void clusterDelNode(clusterNode *delnode);
|
|||||||
sds representClusterNodeFlags(sds ci, uint16_t flags);
|
sds representClusterNodeFlags(sds ci, uint16_t flags);
|
||||||
uint64_t clusterGetMaxEpoch(void);
|
uint64_t clusterGetMaxEpoch(void);
|
||||||
int clusterBumpConfigEpochWithoutConsensus(void);
|
int clusterBumpConfigEpochWithoutConsensus(void);
|
||||||
void moduleCallClusterReceivers(char *sender_id, uint64_t module_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
void moduleCallClusterReceivers(const char *sender_id, uint64_t module_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Initialization
|
* Initialization
|
||||||
@ -932,7 +932,7 @@ void clusterDelNode(clusterNode *delnode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Node lookup by name */
|
/* Node lookup by name */
|
||||||
clusterNode *clusterLookupNode(char *name) {
|
clusterNode *clusterLookupNode(const char *name) {
|
||||||
sds s = sdsnewlen(name, CLUSTER_NAMELEN);
|
sds s = sdsnewlen(name, CLUSTER_NAMELEN);
|
||||||
dictEntry *de;
|
dictEntry *de;
|
||||||
|
|
||||||
@ -2621,7 +2621,7 @@ void clusterSendModule(clusterLink *link, uint64_t module_id, uint8_t type,
|
|||||||
*
|
*
|
||||||
* The function returns C_OK if the target is valid, otherwise C_ERR is
|
* The function returns C_OK if the target is valid, otherwise C_ERR is
|
||||||
* returned. */
|
* returned. */
|
||||||
int clusterSendModuleMessageToTarget(char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) {
|
int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) {
|
||||||
clusterNode *node = NULL;
|
clusterNode *node = NULL;
|
||||||
|
|
||||||
if (target != NULL) {
|
if (target != NULL) {
|
||||||
|
@ -3813,7 +3813,7 @@ void moduleUnsubscribeNotifications(RedisModule *module) {
|
|||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* The Cluster message callback function pointer type. */
|
/* The Cluster message callback function pointer type. */
|
||||||
typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, char *sender_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, const char *sender_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
||||||
|
|
||||||
/* This structure identifies a registered caller: it must match a given module
|
/* This structure identifies a registered caller: it must match a given module
|
||||||
* ID, for a given message type. The callback function is just the function
|
* ID, for a given message type. The callback function is just the function
|
||||||
@ -3830,7 +3830,7 @@ typedef struct moduleClusterReceiver {
|
|||||||
static moduleClusterReceiver *clusterReceivers[UINT8_MAX];
|
static moduleClusterReceiver *clusterReceivers[UINT8_MAX];
|
||||||
|
|
||||||
/* Dispatch the message to the right module receiver. */
|
/* Dispatch the message to the right module receiver. */
|
||||||
void moduleCallClusterReceivers(char *sender_id, uint64_t module_id, uint8_t type, const unsigned char *payload, uint32_t len) {
|
void moduleCallClusterReceivers(const char *sender_id, uint64_t module_id, uint8_t type, const unsigned char *payload, uint32_t len) {
|
||||||
moduleClusterReceiver *r = clusterReceivers[type];
|
moduleClusterReceiver *r = clusterReceivers[type];
|
||||||
while(r) {
|
while(r) {
|
||||||
if (r->module_id == module_id) {
|
if (r->module_id == module_id) {
|
||||||
|
@ -133,7 +133,7 @@ typedef void (*RedisModuleTypeRewriteFunc)(RedisModuleIO *aof, RedisModuleString
|
|||||||
typedef size_t (*RedisModuleTypeMemUsageFunc)(const void *value);
|
typedef size_t (*RedisModuleTypeMemUsageFunc)(const void *value);
|
||||||
typedef void (*RedisModuleTypeDigestFunc)(RedisModuleDigest *digest, void *value);
|
typedef void (*RedisModuleTypeDigestFunc)(RedisModuleDigest *digest, void *value);
|
||||||
typedef void (*RedisModuleTypeFreeFunc)(void *value);
|
typedef void (*RedisModuleTypeFreeFunc)(void *value);
|
||||||
typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, char *sender_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, const char *sender_id, uint8_t type, const unsigned char *payload, uint32_t len);
|
||||||
|
|
||||||
#define REDISMODULE_TYPE_METHOD_VERSION 1
|
#define REDISMODULE_TYPE_METHOD_VERSION 1
|
||||||
typedef struct RedisModuleTypeMethods {
|
typedef struct RedisModuleTypeMethods {
|
||||||
|
@ -1808,7 +1808,7 @@ void clusterCron(void);
|
|||||||
void clusterPropagatePublish(robj *channel, robj *message);
|
void clusterPropagatePublish(robj *channel, robj *message);
|
||||||
void migrateCloseTimedoutSockets(void);
|
void migrateCloseTimedoutSockets(void);
|
||||||
void clusterBeforeSleep(void);
|
void clusterBeforeSleep(void);
|
||||||
int clusterSendModuleMessageToTarget(char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len);
|
int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len);
|
||||||
|
|
||||||
/* Sentinel */
|
/* Sentinel */
|
||||||
void initSentinelConfig(void);
|
void initSentinelConfig(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user