-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcluster.h
More file actions
46 lines (28 loc) · 1.33 KB
/
cluster.h
File metadata and controls
46 lines (28 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright Redis Ltd. 2021 - present
* Licensed under your choice of the Redis Source Available License 2.0 (RSALv2) or
* the Server Side Public License v1 (SSPLv1).
*/
#ifndef SRC_CLUSTER_H_
#define SRC_CLUSTER_H_
#include "redismodule.h"
#include <stdbool.h>
#define CLUSTER_ERROR "ERRCLUSTER"
typedef size_t functionId;
typedef void (*MR_ClusterMessageReceiver)(RedisModuleCtx *ctx, const char *sender_id, uint8_t type, RedisModuleString* payload);
/* Send a message to a shard by shard id,
* NULL id means to send the message to all the shards.
* Take ownership on the given message */
void MR_ClusterSendMsg(const char* nodeId, functionId function, char* msg, size_t len);
void MR_ClusterCopyAndSendMsg(const char* nodeId, functionId function, char* msg, size_t len);
void MR_ClusterSendMsgBySlot(size_t slot, functionId function, char* msg, size_t len);
void MR_ClusterCopyAndSendMsgBySlot(size_t slot, functionId function, char* msg, size_t len);
functionId MR_ClusterRegisterMsgReceiver(MR_ClusterMessageReceiver receiver);
int MR_ClusterIsClusterMode();
const char* MR_ClusterGetMyId();
int MR_IsClusterInitialize();
size_t MR_ClusterGetSize();
int MR_ClusterInit(RedisModuleCtx* rctx, char *password);
size_t MR_ClusterGetSlotdByKey(const char* key, size_t len);
int MR_ClusterIsMySlot(size_t slot);
#endif /* SRC_CLUSTER_H_ */