Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
133130a4
T
Terarkdb
项目概览
indiff7643
/
Terarkdb
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Terarkdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
133130a4
编写于
6月 08, 2015
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #625 from rdallman/c-slice-parts-support
C: add support for WriteBatch SliceParts params
上级
de4d172d
5dc174e1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
151 addition
and
0 deletion
+151
-0
db/c.cc
db/c.cc
+98
-0
db/c_test.c
db/c_test.c
+18
-0
include/rocksdb/c.h
include/rocksdb/c.h
+35
-0
未找到文件。
db/c.cc
浏览文件 @
133130a4
...
...
@@ -65,6 +65,7 @@ using rocksdb::Range;
using
rocksdb
::
ReadOptions
;
using
rocksdb
::
SequentialFile
;
using
rocksdb
::
Slice
;
using
rocksdb
::
SliceParts
;
using
rocksdb
::
SliceTransform
;
using
rocksdb
::
Snapshot
;
using
rocksdb
::
Status
;
...
...
@@ -1140,6 +1141,43 @@ void rocksdb_writebatch_put_cf(
b
->
rep
.
Put
(
column_family
->
rep
,
Slice
(
key
,
klen
),
Slice
(
val
,
vlen
));
}
void
rocksdb_writebatch_putv
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
std
::
vector
<
Slice
>
value_slices
(
num_values
);
for
(
int
i
=
0
;
i
<
num_values
;
i
++
)
{
value_slices
[
i
]
=
Slice
(
values_list
[
i
],
values_list_sizes
[
i
]);
}
b
->
rep
.
Put
(
SliceParts
(
key_slices
.
data
(),
num_keys
),
SliceParts
(
value_slices
.
data
(),
num_values
));
}
void
rocksdb_writebatch_putv_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
std
::
vector
<
Slice
>
value_slices
(
num_values
);
for
(
int
i
=
0
;
i
<
num_values
;
i
++
)
{
value_slices
[
i
]
=
Slice
(
values_list
[
i
],
values_list_sizes
[
i
]);
}
b
->
rep
.
Put
(
column_family
->
rep
,
SliceParts
(
key_slices
.
data
(),
num_keys
),
SliceParts
(
value_slices
.
data
(),
num_values
));
}
void
rocksdb_writebatch_merge
(
rocksdb_writebatch_t
*
b
,
const
char
*
key
,
size_t
klen
,
...
...
@@ -1155,6 +1193,43 @@ void rocksdb_writebatch_merge_cf(
b
->
rep
.
Merge
(
column_family
->
rep
,
Slice
(
key
,
klen
),
Slice
(
val
,
vlen
));
}
void
rocksdb_writebatch_mergev
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
std
::
vector
<
Slice
>
value_slices
(
num_values
);
for
(
int
i
=
0
;
i
<
num_values
;
i
++
)
{
value_slices
[
i
]
=
Slice
(
values_list
[
i
],
values_list_sizes
[
i
]);
}
b
->
rep
.
Merge
(
SliceParts
(
key_slices
.
data
(),
num_keys
),
SliceParts
(
value_slices
.
data
(),
num_values
));
}
void
rocksdb_writebatch_mergev_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
std
::
vector
<
Slice
>
value_slices
(
num_values
);
for
(
int
i
=
0
;
i
<
num_values
;
i
++
)
{
value_slices
[
i
]
=
Slice
(
values_list
[
i
],
values_list_sizes
[
i
]);
}
b
->
rep
.
Merge
(
column_family
->
rep
,
SliceParts
(
key_slices
.
data
(),
num_keys
),
SliceParts
(
value_slices
.
data
(),
num_values
));
}
void
rocksdb_writebatch_delete
(
rocksdb_writebatch_t
*
b
,
const
char
*
key
,
size_t
klen
)
{
...
...
@@ -1168,6 +1243,29 @@ void rocksdb_writebatch_delete_cf(
b
->
rep
.
Delete
(
column_family
->
rep
,
Slice
(
key
,
klen
));
}
void
rocksdb_writebatch_deletev
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
b
->
rep
.
Delete
(
SliceParts
(
key_slices
.
data
(),
num_keys
));
}
void
rocksdb_writebatch_deletev_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
)
{
std
::
vector
<
Slice
>
key_slices
(
num_keys
);
for
(
int
i
=
0
;
i
<
num_keys
;
i
++
)
{
key_slices
[
i
]
=
Slice
(
keys_list
[
i
],
keys_list_sizes
[
i
]);
}
b
->
rep
.
Delete
(
column_family
->
rep
,
SliceParts
(
key_slices
.
data
(),
num_keys
));
}
void
rocksdb_writebatch_iterate
(
rocksdb_writebatch_t
*
b
,
void
*
state
,
...
...
db/c_test.c
浏览文件 @
133130a4
...
...
@@ -465,6 +465,24 @@ int main(int argc, char** argv) {
rocksdb_writebatch_destroy
(
wb
);
}
StartPhase
(
"writebatch_vectors"
);
{
rocksdb_writebatch_t
*
wb
=
rocksdb_writebatch_create
();
const
char
*
k_list
[
2
]
=
{
"z"
,
"ap"
};
const
size_t
k_sizes
[
2
]
=
{
1
,
2
};
const
char
*
v_list
[
3
]
=
{
"x"
,
"y"
,
"z"
};
const
size_t
v_sizes
[
3
]
=
{
1
,
1
,
1
};
rocksdb_writebatch_putv
(
wb
,
2
,
k_list
,
k_sizes
,
3
,
v_list
,
v_sizes
);
rocksdb_write
(
db
,
woptions
,
wb
,
&
err
);
CheckNoError
(
err
);
CheckGet
(
db
,
roptions
,
"zap"
,
"xyz"
);
rocksdb_writebatch_delete
(
wb
,
"zap"
,
3
);
rocksdb_write
(
db
,
woptions
,
wb
,
&
err
);
CheckNoError
(
err
);
CheckGet
(
db
,
roptions
,
"zap"
,
NULL
);
rocksdb_writebatch_destroy
(
wb
);
}
StartPhase
(
"writebatch_rep"
);
{
rocksdb_writebatch_t
*
wb1
=
rocksdb_writebatch_create
();
...
...
include/rocksdb/c.h
浏览文件 @
133130a4
...
...
@@ -408,6 +408,19 @@ extern void rocksdb_writebatch_put_cf(
rocksdb_column_family_handle_t
*
column_family
,
const
char
*
key
,
size_t
klen
,
const
char
*
val
,
size_t
vlen
);
extern
void
rocksdb_writebatch_putv
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
);
extern
void
rocksdb_writebatch_putv_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
);
extern
void
rocksdb_writebatch_merge
(
rocksdb_writebatch_t
*
,
const
char
*
key
,
size_t
klen
,
...
...
@@ -417,6 +430,19 @@ extern void rocksdb_writebatch_merge_cf(
rocksdb_column_family_handle_t
*
column_family
,
const
char
*
key
,
size_t
klen
,
const
char
*
val
,
size_t
vlen
);
extern
void
rocksdb_writebatch_mergev
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
);
extern
void
rocksdb_writebatch_mergev_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
,
int
num_values
,
const
char
*
const
*
values_list
,
const
size_t
*
values_list_sizes
);
extern
void
rocksdb_writebatch_delete
(
rocksdb_writebatch_t
*
,
const
char
*
key
,
size_t
klen
);
...
...
@@ -424,6 +450,15 @@ extern void rocksdb_writebatch_delete_cf(
rocksdb_writebatch_t
*
,
rocksdb_column_family_handle_t
*
column_family
,
const
char
*
key
,
size_t
klen
);
void
rocksdb_writebatch_deletev
(
rocksdb_writebatch_t
*
b
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
);
void
rocksdb_writebatch_deletev_cf
(
rocksdb_writebatch_t
*
b
,
rocksdb_column_family_handle_t
*
column_family
,
int
num_keys
,
const
char
*
const
*
keys_list
,
const
size_t
*
keys_list_sizes
);
extern
void
rocksdb_writebatch_iterate
(
rocksdb_writebatch_t
*
,
void
*
state
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录