Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
3d00271e
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,发现更多精彩内容 >>
提交
3d00271e
编写于
7月 14, 2015
作者:
A
Adam Retter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The ability to specify a compaction filter via the Java API
上级
62dec0e2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
1 deletion
+78
-1
java/Makefile
java/Makefile
+2
-1
java/rocksjni/compaction_filter.cc
java/rocksjni/compaction_filter.cc
+24
-0
java/rocksjni/options.cc
java/rocksjni/options.cc
+13
-0
java/src/main/java/org/rocksdb/AbstractCompactionFilter.java
java/src/main/java/org/rocksdb/AbstractCompactionFilter.java
+29
-0
java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
+9
-0
src.mk
src.mk
+1
-0
未找到文件。
java/Makefile
浏览文件 @
3d00271e
NATIVE_JAVA_CLASSES
=
org.rocksdb.AbstractComparator
\
NATIVE_JAVA_CLASSES
=
org.rocksdb.AbstractCompactionFilter
\
org.rocksdb.AbstractComparator
\
org.rocksdb.AbstractSlice
\
org.rocksdb.BackupableDB
\
org.rocksdb.BackupableDBOptions
\
...
...
java/rocksjni/compaction_filter.cc
0 → 100644
浏览文件 @
3d00271e
// Copyright (c) 2015, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
// This file implements the "bridge" between Java and C++ for
// rocksdb::CompactionFilter.
#include <jni.h>
#include "rocksdb/compaction_filter.h"
// <editor-fold desc="org.rocksdb.AbstractCompactionFilter">
/*
* Class: org_rocksdb_AbstractCompactionFilter
* Method: disposeInternal
* Signature: (J)V
*/
void
Java_org_rocksdb_AbstractCompactionFilter_disposeInternal
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
handle
)
{
delete
reinterpret_cast
<
rocksdb
::
CompactionFilter
*>
(
handle
);
}
// </editor-fold>
java/rocksjni/options.cc
浏览文件 @
3d00271e
...
...
@@ -2053,6 +2053,19 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperator(
(
mergeOperatorHandle
));
}
/*
* Class: org_rocksdb_ColumnFamilyOptions
* Method: setCompactionFilterHandle
* Signature: (JJ)V
*/
void
Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterHandle__JJ
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
jopt_handle
,
jlong
jcompactionfilter_handle
)
{
reinterpret_cast
<
rocksdb
::
ColumnFamilyOptions
*>
(
jopt_handle
)
->
compaction_filter
=
reinterpret_cast
<
rocksdb
::
CompactionFilter
*>
(
jcompactionfilter_handle
);
}
/*
* Class: org_rocksdb_ColumnFamilyOptions
* Method: setWriteBufferSize
...
...
java/src/main/java/org/rocksdb/AbstractCompactionFilter.java
0 → 100644
浏览文件 @
3d00271e
// Copyright (c) 2015, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
package
org.rocksdb
;
/**
* A CompactionFilter allows an application to modify/delete a key-value at
* the time of compaction.
*
* At present we just permit an overriding Java class to wrap a C++ implementation
*/
public
abstract
class
AbstractCompactionFilter
<
T
extends
AbstractSlice
<?>>
extends
RocksObject
{
/**
* Deletes underlying C++ comparator pointer.
*
* Note that this function should be called only after all
* RocksDB instances referencing the comparator are closed.
* Otherwise an undefined behavior will occur.
*/
@Override
protected
void
disposeInternal
()
{
assert
(
isInitialized
());
disposeInternal
(
nativeHandle_
);
}
private
native
void
disposeInternal
(
long
handle
);
}
java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
浏览文件 @
3d00271e
...
...
@@ -145,6 +145,13 @@ public class ColumnFamilyOptions extends RocksObject
return
this
;
}
public
ColumnFamilyOptions
setCompactionFilter
(
final
AbstractCompactionFilter
<?
extends
AbstractSlice
<?>>
compactionFilter
)
{
setCompactionFilterHandle
(
nativeHandle_
,
compactionFilter
.
nativeHandle_
);
compactionFilter_
=
compactionFilter
;
return
this
;
}
@Override
public
ColumnFamilyOptions
setWriteBufferSize
(
final
long
writeBufferSize
)
{
assert
(
isInitialized
());
...
...
@@ -680,6 +687,7 @@ public class ColumnFamilyOptions extends RocksObject
long
handle
,
String
name
);
private
native
void
setMergeOperator
(
long
handle
,
long
mergeOperatorHandle
);
private
native
void
setCompactionFilterHandle
(
long
handle
,
long
compactionFilterHandle
);
private
native
void
setWriteBufferSize
(
long
handle
,
long
writeBufferSize
)
throws
IllegalArgumentException
;
private
native
long
writeBufferSize
(
long
handle
);
...
...
@@ -803,4 +811,5 @@ public class ColumnFamilyOptions extends RocksObject
MemTableConfig
memTableConfig_
;
TableFormatConfig
tableFormatConfig_
;
AbstractComparator
<?
extends
AbstractSlice
<?>>
comparator_
;
AbstractCompactionFilter
<?
extends
AbstractSlice
<?>>
compactionFilter_
;
}
src.mk
浏览文件 @
3d00271e
...
...
@@ -246,6 +246,7 @@ JNI_NATIVE_SOURCES = \
java/rocksjni/backupablejni.cc
\
java/rocksjni/checkpoint.cc
\
java/rocksjni/columnfamilyhandle.cc
\
java/rocksjni/compaction_filter.cc
\
java/rocksjni/comparator.cc
\
java/rocksjni/comparatorjnicallback.cc
\
java/rocksjni/env.cc
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录