提供array和hashtable的存储引擎层的二进制安全支持,把入口函数修改为接收参数长度,将strlen、strcmp、strcpy替换。

This commit is contained in:
2026-01-06 21:05:48 +08:00
parent 144b374aa2
commit cb0134a852
12 changed files with 767 additions and 223 deletions

View File

@@ -25,7 +25,7 @@ int kvs_write_u32(uint8_t **pp, const uint8_t *end, uint32_t v);
#define KVS_MAX_CMDS_PER_CALL 64
// 1MB
#define KVS_MAX_RESPONSE (1024u * 1024u)
#define KVS_MAX_ARGC 64
#define KVS_MAX_ARGC 4
#define KVS_MAX_ARGLEN (1024u * 1024u)
#define KVS_MAX_CMD_BYTES (4u * 1024u * 1024u)
@@ -37,6 +37,30 @@ enum {
KVS_STATUS_BADREQ = 4
};
enum {
KVS_CMD_START = 0,
// array
KVS_CMD_SET = KVS_CMD_START,
KVS_CMD_GET,
KVS_CMD_DEL,
KVS_CMD_MOD,
KVS_CMD_EXIST,
// rbtree
KVS_CMD_RSET,
KVS_CMD_RGET,
KVS_CMD_RDEL,
KVS_CMD_RMOD,
KVS_CMD_REXIST,
// hash
KVS_CMD_HSET,
KVS_CMD_HGET,
KVS_CMD_HDEL,
KVS_CMD_HMOD,
KVS_CMD_HEXIST,
KVS_CMD_COUNT,
};
typedef enum {
KVS_OK = 1,
KVS_NEED_MORE = 0,