已有数据同步功能完成
This commit is contained in:
@@ -191,8 +191,8 @@ int kvs_array_exist_bin(kvs_array_t *inst, const void *key, uint32_t key_len) {
|
||||
}
|
||||
|
||||
// return: 0 success, <0 error
|
||||
int kvs_array_save(kvs_array_t *inst, const char* filename){
|
||||
if(!inst || !filename) return -1;
|
||||
int kvs_array_save(iouring_ctx_t *uring, kvs_array_t *inst, const char* filename){
|
||||
if(!uring || !inst || !filename) return -1;
|
||||
|
||||
int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) return -2;
|
||||
@@ -234,7 +234,7 @@ int kvs_array_save(kvs_array_t *inst, const char* filename){
|
||||
size_t total = 0;
|
||||
for (int i = 0; i < count; i++) total += lens[i];
|
||||
|
||||
task_t *t = submit_write(&global_uring_ctx, fd, bufs, lens, count, current_off);
|
||||
task_t *t = submit_write(uring, fd, bufs, lens, count, current_off);
|
||||
|
||||
if (!t) { close(fd); return -4; }
|
||||
int res = task_wait(t);
|
||||
|
||||
Reference in New Issue
Block a user