提交 2d968c4c authored 作者: Thomas Mueller's avatar Thomas Mueller

A persistent multi-version map: rename built-in data type classes

上级 16d007fa
......@@ -25,13 +25,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
/**
* The spatial key type.
*/
final SpatialType keyType;
final SpatialDataType keyType;
private boolean quadraticSplit;
public MVRTreeMap(int dimensions, DataType valueType) {
super(new SpatialType(dimensions), valueType);
this.keyType = (SpatialType) getKeyType();
super(new SpatialDataType(dimensions), valueType);
this.keyType = (SpatialDataType) getKeyType();
}
/**
......
......@@ -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.TestObjectDataType;
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 TestObjectDataType().runTest(this);
new TestStreamStore().runTest(this);
// unit
......
......@@ -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);
}
......
......@@ -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.ObjectDataTypeFactory;
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 ObjectDataTypeFactory()).open();
s.setPageSize(3);
final MVMap<Integer, Integer> map = s.openMap("test");
final int len = 10;
......
......@@ -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.ObjectDataType;
import org.h2.mvstore.type.StringDataType;
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 ObjectDataType());
// 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, StringDataType.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, StringDataType.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, StringDataType.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, StringDataType.INSTANCE);
m = s.openMap("data", m);
HashMap<SpatialKey, String> map = new HashMap<SpatialKey, String>();
Random rand = new Random(1);
......
......@@ -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.ObjectDataType;
import org.h2.mvstore.type.ObjectDataTypeFactory;
import org.h2.mvstore.type.StringDataType;
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 ObjectDataTypeFactory()).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 ObjectDataTypeFactory()).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 ObjectDataTypeFactory()).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 ObjectDataTypeFactory()).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 ObjectDataType(),
new RowDataType(new DataType[] {
new ObjectDataType(),
StringDataType.INSTANCE,
StringDataType.INSTANCE
})
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论