Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2d968c4c
提交
2d968c4c
authored
11月 30, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A persistent multi-version map: rename built-in data type classes
上级
16d007fa
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
30 行增加
和
35 行删除
+30
-35
MVRTreeMap.java
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
+3
-3
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-2
SampleTypeFactory.java
h2/src/test/org/h2/test/store/SampleTypeFactory.java
+2
-8
TestConcurrent.java
h2/src/test/org/h2/test/store/TestConcurrent.java
+2
-2
TestMVRTree.java
h2/src/test/org/h2/test/store/TestMVRTree.java
+7
-7
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+14
-13
没有找到文件。
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
浏览文件 @
2d968c4c
...
...
@@ -25,13 +25,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
/**
* The spatial key type.
*/
final
SpatialType
keyType
;
final
Spatial
Data
Type
keyType
;
private
boolean
quadraticSplit
;
public
MVRTreeMap
(
int
dimensions
,
DataType
valueType
)
{
super
(
new
SpatialType
(
dimensions
),
valueType
);
this
.
keyType
=
(
SpatialType
)
getKeyType
();
super
(
new
Spatial
Data
Type
(
dimensions
),
valueType
);
this
.
keyType
=
(
Spatial
Data
Type
)
getKeyType
();
}
/**
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
2d968c4c
...
...
@@ -110,7 +110,7 @@ import org.h2.test.store.TestConcurrent;
import
org.h2.test.store.TestDataUtils
;
import
org.h2.test.store.TestMVStore
;
import
org.h2.test.store.TestMVRTree
;
import
org.h2.test.store.TestObjectType
;
import
org.h2.test.store.TestObject
Data
Type
;
import
org.h2.test.store.TestStreamStore
;
import
org.h2.test.synth.TestBtreeIndex
;
import
org.h2.test.synth.TestCrashAPI
;
...
...
@@ -682,7 +682,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new
TestDataUtils
().
runTest
(
this
);
new
TestMVRTree
().
runTest
(
this
);
new
TestMVStore
().
runTest
(
this
);
new
TestObjectType
().
runTest
(
this
);
new
TestObject
Data
Type
().
runTest
(
this
);
new
TestStreamStore
().
runTest
(
this
);
// unit
...
...
h2/src/test/org/h2/test/store/SampleTypeFactory.java
浏览文件 @
2d968c4c
...
...
@@ -21,20 +21,14 @@ public class SampleTypeFactory implements DataTypeFactory {
@Override
public
DataType
buildDataType
(
String
s
)
{
// if ("org.h2.test.store.int".equals(s)) {
// return new IntegerType();
// } else
if
(
s
.
startsWith
(
RowType
.
PREFIX
))
{
return
RowType
.
fromString
(
s
,
this
);
if
(
s
.
startsWith
(
RowDataType
.
PREFIX
))
{
return
RowDataType
.
fromString
(
s
,
this
);
}
return
parent
.
buildDataType
(
s
);
}
@Override
public
String
getDataType
(
Class
<?>
objectClass
)
{
// if (objectClass == Integer.class) {
// return "org.h2.test.store.int";
// }
return
parent
.
getDataType
(
objectClass
);
}
...
...
h2/src/test/org/h2/test/store/TestConcurrent.java
浏览文件 @
2d968c4c
...
...
@@ -17,7 +17,7 @@ import java.util.Random;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStoreBuilder
;
import
org.h2.mvstore.type.ObjectTypeFactory
;
import
org.h2.mvstore.type.Object
Data
TypeFactory
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.util.Task
;
...
...
@@ -133,7 +133,7 @@ public class TestConcurrent extends TestMVStore {
private
void
testConcurrentIterate
()
{
MVStore
s
=
MVStoreBuilder
.
inMemory
().
with
(
new
ObjectTypeFactory
()).
open
();
with
(
new
Object
Data
TypeFactory
()).
open
();
s
.
setPageSize
(
3
);
final
MVMap
<
Integer
,
Integer
>
map
=
s
.
openMap
(
"test"
);
final
int
len
=
10
;
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
2d968c4c
...
...
@@ -23,8 +23,8 @@ import javax.imageio.stream.FileImageOutputStream;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.rtree.MVRTreeMap
;
import
org.h2.mvstore.rtree.SpatialKey
;
import
org.h2.mvstore.type.ObjectType
;
import
org.h2.mvstore.type.StringType
;
import
org.h2.mvstore.type.Object
Data
Type
;
import
org.h2.mvstore.type.String
Data
Type
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.util.New
;
...
...
@@ -56,7 +56,7 @@ public class TestMVRTree extends TestMVStore {
// create an R-tree map
// the key has 2 dimensions, the value is a string
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
new
ObjectType
());
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
new
Object
Data
Type
());
// open the map
r
=
s
.
openMap
(
"data"
,
r
);
...
...
@@ -84,7 +84,7 @@ public class TestMVRTree extends TestMVStore {
MVStore
s
;
s
=
openStore
(
fileName
);
// s.setMaxPageSize(50);
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
StringType
.
INSTANCE
);
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
String
Data
Type
.
INSTANCE
);
r
=
s
.
openMap
(
"data"
,
r
);
// r.setQuadraticSplit(true);
Random
rand
=
new
Random
(
1
);
...
...
@@ -109,7 +109,7 @@ public class TestMVRTree extends TestMVStore {
s
.
store
();
s
.
close
();
s
=
openStore
(
fileName
);
r
=
MVRTreeMap
.
create
(
2
,
StringType
.
INSTANCE
);
r
=
MVRTreeMap
.
create
(
2
,
String
Data
Type
.
INSTANCE
);
r
=
s
.
openMap
(
"data"
,
r
);
// t = System.currentTimeMillis();
rand
=
new
Random
(
1
);
...
...
@@ -148,7 +148,7 @@ public class TestMVRTree extends TestMVStore {
FileUtils
.
delete
(
fileName
);
MVStore
s
;
s
=
openStore
(
fileName
);
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
StringType
.
INSTANCE
);
MVRTreeMap
<
String
>
r
=
MVRTreeMap
.
create
(
2
,
String
Data
Type
.
INSTANCE
);
r
=
s
.
openMap
(
"data"
,
r
);
add
(
r
,
"Bern"
,
key
(
0
,
46.57
,
7.27
,
124381
));
add
(
r
,
"Basel"
,
key
(
1
,
47.34
,
7.36
,
170903
));
...
...
@@ -268,7 +268,7 @@ public class TestMVRTree extends TestMVStore {
String
fileName
=
getBaseDir
()
+
"/testRandom.h3"
;
FileUtils
.
delete
(
fileName
);
MVStore
s
=
openStore
(
fileName
);
MVRTreeMap
<
String
>
m
=
MVRTreeMap
.
create
(
2
,
StringType
.
INSTANCE
);
MVRTreeMap
<
String
>
m
=
MVRTreeMap
.
create
(
2
,
String
Data
Type
.
INSTANCE
);
m
=
s
.
openMap
(
"data"
,
m
);
HashMap
<
SpatialKey
,
String
>
map
=
new
HashMap
<
SpatialKey
,
String
>();
Random
rand
=
new
Random
(
1
);
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
2d968c4c
...
...
@@ -18,9 +18,9 @@ import org.h2.mvstore.MVMap;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStoreBuilder
;
import
org.h2.mvstore.type.DataType
;
import
org.h2.mvstore.type.ObjectType
;
import
org.h2.mvstore.type.ObjectTypeFactory
;
import
org.h2.mvstore.type.StringType
;
import
org.h2.mvstore.type.Object
Data
Type
;
import
org.h2.mvstore.type.Object
Data
TypeFactory
;
import
org.h2.mvstore.type.String
Data
Type
;
import
org.h2.store.fs.FilePath
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
...
...
@@ -93,7 +93,8 @@ public class TestMVStore extends TestBase {
MVStore
s
;
MVMap
<
Integer
,
String
>
map
;
s
=
MVStoreBuilder
.
fileBased
(
fileName
).
with
(
new
ObjectTypeFactory
()).
open
();
compressData
().
with
(
new
ObjectDataTypeFactory
()).
open
();
map
=
s
.
openMap
(
"test"
);
// add 10 MB of data
for
(
int
i
=
0
;
i
<
1024
;
i
++)
{
...
...
@@ -107,7 +108,7 @@ public class TestMVStore extends TestBase {
for
(
int
cacheSize
=
0
;
cacheSize
<=
6
;
cacheSize
+=
4
)
{
s
=
MVStoreBuilder
.
fileBased
(
fileName
).
cacheSizeMB
(
1
+
3
*
cacheSize
).
with
(
new
ObjectTypeFactory
()).
open
();
with
(
new
Object
Data
TypeFactory
()).
open
();
map
=
s
.
openMap
(
"test"
);
for
(
int
i
=
0
;
i
<
1024
;
i
+=
128
)
{
for
(
int
j
=
0
;
j
<
i
;
j
++)
{
...
...
@@ -329,7 +330,7 @@ public class TestMVStore extends TestBase {
MVStore
s
;
Map
<
Integer
,
Integer
>
map
;
s
=
MVStoreBuilder
.
inMemory
().
with
(
new
ObjectTypeFactory
()).
open
();
with
(
new
Object
Data
TypeFactory
()).
open
();
map
=
s
.
openMap
(
"test"
);
int
len
=
100
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
@@ -355,7 +356,7 @@ public class TestMVStore extends TestBase {
MVStore
s
;
Map
<
Object
,
Object
>
map
;
s
=
MVStoreBuilder
.
fileBased
(
fileName
).
with
(
new
ObjectTypeFactory
()).
open
();
with
(
new
Object
Data
TypeFactory
()).
open
();
map
=
s
.
openMap
(
"test"
);
map
.
put
(
1
,
"Hello"
);
map
.
put
(
"2"
,
200
);
...
...
@@ -363,7 +364,7 @@ public class TestMVStore extends TestBase {
s
.
store
();
s
.
close
();
s
=
MVStoreBuilder
.
fileBased
(
fileName
).
with
(
new
ObjectTypeFactory
()).
open
();
with
(
new
Object
Data
TypeFactory
()).
open
();
map
=
s
.
openMap
(
"test"
);
assertEquals
(
"Hello"
,
map
.
get
(
1
).
toString
());
assertEquals
(
200
,
((
Integer
)
map
.
get
(
"2"
)).
intValue
());
...
...
@@ -791,11 +792,11 @@ public class TestMVStore extends TestBase {
// s.setCompressor(null);
s
.
setPageSize
(
40
);
MVMap
<
Integer
,
Object
[]>
m
=
new
MVMap
<
Integer
,
Object
[]>(
new
ObjectType
(),
new
RowType
(
new
DataType
[]
{
new
ObjectType
(),
StringType
.
INSTANCE
,
StringType
.
INSTANCE
new
Object
Data
Type
(),
new
Row
Data
Type
(
new
DataType
[]
{
new
Object
Data
Type
(),
String
Data
Type
.
INSTANCE
,
String
Data
Type
.
INSTANCE
})
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论