Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
fa9cfc65
R
rocksdb
项目概览
kvdb
/
rocksdb
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
fa9cfc65
编写于
11月 05, 2014
作者:
F
fyrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RocksJava] Integrated Review comments from yhchiang in D28023
上级
75010d20
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
18 deletion
+19
-18
java/org/rocksdb/RocksDB.java
java/org/rocksdb/RocksDB.java
+11
-11
java/org/rocksdb/test/ColumnFamilyTest.java
java/org/rocksdb/test/ColumnFamilyTest.java
+5
-1
java/org/rocksdb/test/KeyMayExistTest.java
java/org/rocksdb/test/KeyMayExistTest.java
+1
-1
java/org/rocksdb/test/MergeTest.java
java/org/rocksdb/test/MergeTest.java
+2
-5
未找到文件。
java/org/rocksdb/RocksDB.java
浏览文件 @
fa9cfc65
...
...
@@ -130,14 +130,14 @@ public class RocksDB extends RocksObject {
* {@link RocksDB} can not be opened.
*
* @throws org.rocksdb.RocksDBException
* @see Options#setCreateIfMissing(boolean)
* @see
DB
Options#setCreateIfMissing(boolean)
*/
public
static
RocksDB
open
(
String
path
,
List
<
ColumnFamilyDescriptor
>
columnFamilyDescriptors
,
List
<
ColumnFamilyHandle
>
columnFamilyHandles
)
throws
RocksDBException
{
// This allows to use the rocksjni default Options instead of
// the c++ one.
Options
options
=
new
Options
();
DBOptions
options
=
new
DB
Options
();
return
open
(
options
,
path
,
columnFamilyDescriptors
,
columnFamilyHandles
);
}
...
...
@@ -197,7 +197,7 @@ public class RocksDB extends RocksObject {
* <p>
* ColumnFamily handles are disposed when the RocksDB instance is disposed.</p>
*
* @param options {@link org.rocksdb.Options} instance.
* @param options {@link org.rocksdb.
DB
Options} instance.
* @param path the path to the rocksdb.
* @param columnFamilyDescriptors list of column family descriptors
* @param columnFamilyHandles will be filled with ColumnFamilyHandle instances
...
...
@@ -206,16 +206,16 @@ public class RocksDB extends RocksObject {
* {@link RocksDB} can not be opened.
*
* @throws org.rocksdb.RocksDBException
* @see Options#setCreateIfMissing(boolean)
* @see
DB
Options#setCreateIfMissing(boolean)
*/
public
static
RocksDB
open
(
Options
options
,
String
path
,
public
static
RocksDB
open
(
DB
Options
options
,
String
path
,
List
<
ColumnFamilyDescriptor
>
columnFamilyDescriptors
,
List
<
ColumnFamilyHandle
>
columnFamilyHandles
)
throws
RocksDBException
{
RocksDB
db
=
new
RocksDB
();
List
<
Long
>
cfReferences
=
db
.
open
(
options
.
nativeHandle_
,
path
,
columnFamilyDescriptors
,
columnFamilyDescriptors
.
size
());
for
(
int
i
=
0
;
i
<
columnFamilyDescriptors
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
columnFamilyDescriptors
.
size
();
i
++)
{
columnFamilyHandles
.
add
(
new
ColumnFamilyHandle
(
db
,
cfReferences
.
get
(
i
)));
}
db
.
storeOptionsInstance
(
options
);
...
...
@@ -258,7 +258,7 @@ public class RocksDB extends RocksObject {
List
<
ColumnFamilyHandle
>
columnFamilyHandles
)
throws
RocksDBException
{
// This allows to use the rocksjni default Options instead of
// the c++ one.
Options
options
=
new
Options
();
DBOptions
options
=
new
DB
Options
();
return
openReadOnly
(
options
,
path
,
columnFamilyDescriptors
,
columnFamilyHandles
);
}
...
...
@@ -301,7 +301,7 @@ public class RocksDB extends RocksObject {
* options instance have been closed. If user doesn't call options dispose
* explicitly,then this options instance will be GC'd automatically.</p>
*
* @param options {@link Options} instance.
* @param options {@link
DB
Options} instance.
* @param path the path to the RocksDB.
* @param columnFamilyDescriptors list of column family descriptors
* @param columnFamilyHandles will be filled with ColumnFamilyHandle instances
...
...
@@ -310,7 +310,7 @@ public class RocksDB extends RocksObject {
* {@link RocksDB} can not be opened.
* @throws RocksDBException
*/
public
static
RocksDB
openReadOnly
(
Options
options
,
String
path
,
public
static
RocksDB
openReadOnly
(
DB
Options
options
,
String
path
,
List
<
ColumnFamilyDescriptor
>
columnFamilyDescriptors
,
List
<
ColumnFamilyHandle
>
columnFamilyHandles
)
throws
RocksDBException
{
...
...
@@ -342,7 +342,7 @@ public class RocksDB extends RocksObject {
return
RocksDB
.
listColumnFamilies
(
options
.
nativeHandle_
,
path
);
}
private
void
storeOptionsInstance
(
Options
options
)
{
private
void
storeOptionsInstance
(
DBOptionsInterface
options
)
{
options_
=
options
;
}
...
...
@@ -1247,5 +1247,5 @@ public class RocksDB extends RocksObject {
private
native
void
flush
(
long
handle
,
long
flushOptHandle
,
long
cfHandle
)
throws
RocksDBException
;
protected
Options
options_
;
protected
DBOptionsInterface
options_
;
}
java/org/rocksdb/test/ColumnFamilyTest.java
浏览文件 @
fa9cfc65
...
...
@@ -22,6 +22,10 @@ public class ColumnFamilyTest {
RocksDB
db
=
null
;
Options
options
=
new
Options
();
options
.
setCreateIfMissing
(
true
);
DBOptions
dbOptions
=
new
DBOptions
();
dbOptions
.
setCreateIfMissing
(
true
);
try
{
db
=
RocksDB
.
open
(
options
,
db_path
);
}
catch
(
RocksDBException
e
)
{
...
...
@@ -76,7 +80,7 @@ public class ColumnFamilyTest {
cfNames
.
add
(
new
ColumnFamilyDescriptor
(
"new_cf"
));
try
{
db
=
RocksDB
.
open
(
o
ptions
,
db_path
,
cfNames
,
columnFamilyHandleList
);
db
=
RocksDB
.
open
(
dbO
ptions
,
db_path
,
cfNames
,
columnFamilyHandleList
);
assert
(
columnFamilyHandleList
.
size
()
==
2
);
db
.
put
(
"dfkey1"
.
getBytes
(),
"dfvalue"
.
getBytes
());
db
.
put
(
columnFamilyHandleList
.
get
(
0
),
"dfkey2"
.
getBytes
(),
...
...
java/org/rocksdb/test/KeyMayExistTest.java
浏览文件 @
fa9cfc65
...
...
@@ -17,7 +17,7 @@ public class KeyMayExistTest {
public
static
void
main
(
String
[]
args
){
RocksDB
db
;
Options
options
=
new
Options
();
DBOptions
options
=
new
DB
Options
();
options
.
setCreateIfMissing
(
true
)
.
setCreateMissingColumnFamilies
(
true
);
try
{
...
...
java/org/rocksdb/test/MergeTest.java
浏览文件 @
fa9cfc65
...
...
@@ -7,7 +7,6 @@ package org.rocksdb.test;
import
java.util.List
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
org.rocksdb.*
;
public
class
MergeTest
{
...
...
@@ -41,10 +40,9 @@ public class MergeTest {
public
static
void
testCFStringOption
()
throws
InterruptedException
,
RocksDBException
{
Options
opt
=
new
Options
();
DBOptions
opt
=
new
DB
Options
();
opt
.
setCreateIfMissing
(
true
);
opt
.
setCreateMissingColumnFamilies
(
true
);
opt
.
setMergeOperatorName
(
"stringappend"
);
List
<
ColumnFamilyDescriptor
>
cfDescr
=
new
ArrayList
<
ColumnFamilyDescriptor
>();
...
...
@@ -102,11 +100,10 @@ public class MergeTest {
public
static
void
testCFOperatorOption
()
throws
InterruptedException
,
RocksDBException
{
Options
opt
=
new
Options
();
DBOptions
opt
=
new
DB
Options
();
opt
.
setCreateIfMissing
(
true
);
opt
.
setCreateMissingColumnFamilies
(
true
);
StringAppendOperator
stringAppendOperator
=
new
StringAppendOperator
();
opt
.
setMergeOperator
(
stringAppendOperator
);
List
<
ColumnFamilyDescriptor
>
cfDescr
=
new
ArrayList
<
ColumnFamilyDescriptor
>();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录