Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
a187e66a
R
rocksdb
项目概览
kvdb
/
rocksdb
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a187e66a
编写于
5月 31, 2015
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #617 from rdallman/wb-merge-sliceparts
WriteBatch.Merge w/ SliceParts support
上级
16c19762
a0635ba3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
0 deletion
+53
-0
db/write_batch.cc
db/write_batch.cc
+21
-0
db/write_batch_base.cc
db/write_batch_base.cc
+17
-0
db/write_batch_internal.h
db/write_batch_internal.h
+3
-0
include/rocksdb/write_batch.h
include/rocksdb/write_batch.h
+7
-0
include/rocksdb/write_batch_base.h
include/rocksdb/write_batch_base.h
+5
-0
未找到文件。
db/write_batch.cc
浏览文件 @
a187e66a
...
...
@@ -275,6 +275,27 @@ void WriteBatch::Merge(ColumnFamilyHandle* column_family, const Slice& key,
WriteBatchInternal
::
Merge
(
this
,
GetColumnFamilyID
(
column_family
),
key
,
value
);
}
void
WriteBatchInternal
::
Merge
(
WriteBatch
*
b
,
uint32_t
column_family_id
,
const
SliceParts
&
key
,
const
SliceParts
&
value
)
{
WriteBatchInternal
::
SetCount
(
b
,
WriteBatchInternal
::
Count
(
b
)
+
1
);
if
(
column_family_id
==
0
)
{
b
->
rep_
.
push_back
(
static_cast
<
char
>
(
kTypeMerge
));
}
else
{
b
->
rep_
.
push_back
(
static_cast
<
char
>
(
kTypeColumnFamilyMerge
));
PutVarint32
(
&
b
->
rep_
,
column_family_id
);
}
PutLengthPrefixedSliceParts
(
&
b
->
rep_
,
key
);
PutLengthPrefixedSliceParts
(
&
b
->
rep_
,
value
);
}
void
WriteBatch
::
Merge
(
ColumnFamilyHandle
*
column_family
,
const
SliceParts
&
key
,
const
SliceParts
&
value
)
{
WriteBatchInternal
::
Merge
(
this
,
GetColumnFamilyID
(
column_family
),
key
,
value
);
}
void
WriteBatch
::
PutLogData
(
const
Slice
&
blob
)
{
rep_
.
push_back
(
static_cast
<
char
>
(
kTypeLogData
));
PutLengthPrefixedSlice
(
&
rep_
,
blob
);
...
...
db/write_batch_base.cc
浏览文件 @
a187e66a
...
...
@@ -43,4 +43,21 @@ void WriteBatchBase::Delete(const SliceParts& key) {
Delete
(
key_slice
);
}
void
WriteBatchBase
::
Merge
(
ColumnFamilyHandle
*
column_family
,
const
SliceParts
&
key
,
const
SliceParts
&
value
)
{
std
::
string
key_buf
,
value_buf
;
Slice
key_slice
(
key
,
&
key_buf
);
Slice
value_slice
(
value
,
&
value_buf
);
Merge
(
column_family
,
key_slice
,
value_slice
);
}
void
WriteBatchBase
::
Merge
(
const
SliceParts
&
key
,
const
SliceParts
&
value
)
{
std
::
string
key_buf
,
value_buf
;
Slice
key_slice
(
key
,
&
key_buf
);
Slice
value_slice
(
value
,
&
value_buf
);
Merge
(
key_slice
,
value_slice
);
}
}
// namespace rocksdb
db/write_batch_internal.h
浏览文件 @
a187e66a
...
...
@@ -76,6 +76,9 @@ class WriteBatchInternal {
static
void
Merge
(
WriteBatch
*
batch
,
uint32_t
column_family_id
,
const
Slice
&
key
,
const
Slice
&
value
);
static
void
Merge
(
WriteBatch
*
batch
,
uint32_t
column_family_id
,
const
SliceParts
&
key
,
const
SliceParts
&
value
);
// Return the number of entries in the batch.
static
int
Count
(
const
WriteBatch
*
batch
);
...
...
include/rocksdb/write_batch.h
浏览文件 @
a187e66a
...
...
@@ -66,6 +66,13 @@ class WriteBatch : public WriteBatchBase {
Merge
(
nullptr
,
key
,
value
);
}
// variant that takes SliceParts
void
Merge
(
ColumnFamilyHandle
*
column_family
,
const
SliceParts
&
key
,
const
SliceParts
&
value
)
override
;
void
Merge
(
const
SliceParts
&
key
,
const
SliceParts
&
value
)
override
{
Merge
(
nullptr
,
key
,
value
);
}
using
WriteBatchBase
::
Delete
;
// If the database contains a mapping for "key", erase it. Else do nothing.
void
Delete
(
ColumnFamilyHandle
*
column_family
,
const
Slice
&
key
)
override
;
...
...
include/rocksdb/write_batch_base.h
浏览文件 @
a187e66a
...
...
@@ -40,6 +40,11 @@ class WriteBatchBase {
const
Slice
&
value
)
=
0
;
virtual
void
Merge
(
const
Slice
&
key
,
const
Slice
&
value
)
=
0
;
// variant that takes SliceParts
virtual
void
Merge
(
ColumnFamilyHandle
*
column_family
,
const
SliceParts
&
key
,
const
SliceParts
&
value
);
virtual
void
Merge
(
const
SliceParts
&
key
,
const
SliceParts
&
value
);
// If the database contains a mapping for "key", erase it. Else do nothing.
virtual
void
Delete
(
ColumnFamilyHandle
*
column_family
,
const
Slice
&
key
)
=
0
;
virtual
void
Delete
(
const
Slice
&
key
)
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录