已有数据同步功能完成

This commit is contained in:
1iaan
2026-01-29 10:47:24 +00:00
parent fe257cafec
commit 2bdb48d63d
27 changed files with 1134 additions and 139 deletions

View File

@@ -336,7 +336,7 @@ const char *command[] = {
"SET", "GET", "DEL", "MOD", "EXIST",
"RSET", "RGET", "RDEL", "RMOD", "REXIST",
"HSET", "HGET", "HDEL", "HMOD", "HEXIST",
"SAVE", "PSYNC"
"SAVE", "SSYNC", "SREADY"
};
@@ -536,16 +536,19 @@ int resp_dispatch(const resp_cmd_t *cmd, resp_value_t *out_value) {
/* ---------------- misc ---------------- */
case KVS_CMD_SAVE: {
if (cmd->argc != 1) { *out_value = resp_error("ERR wrong number of arguments for 'save'"); return 0; }
int r = kvs_create_snapshot(global_array_file, global_rbtree_file, global_hash_file);
int r = kvs_create_snapshot(&global_uring_ctx, global_array_file, global_rbtree_file, global_hash_file);
if(r == 0) ksv_clear_log(global_oplog_fd);
if (r < 0) { *out_value = resp_error("ERR save failed"); return 0; }
*out_value = resp_simple("OK");
return 0;
}
case KVS_CMD_PSYNC:
case KVS_CMD_SSYNC:
kvs_create_snapshot_async(cmd->argv[1].ptr, atoi(cmd->argv[2].ptr));
*out_value = resp_simple("OK");
return 0;
case KVS_CMD_SREADY:
*out_value = resp_simple("OK");
return 0;
default:
break;
}