提交 27dd3927 authored 作者: Thomas Mueller's avatar Thomas Mueller

A persistent multi-version map: compressor is part of the factory

上级 66b7ede9
......@@ -5,6 +5,8 @@
*/
package org.h2.test.store;
import org.h2.compress.CompressLZF;
import org.h2.compress.Compressor;
import org.h2.dev.store.btree.MVMap;
import org.h2.dev.store.btree.MVStore;
import org.h2.dev.store.btree.DataType;
......@@ -57,4 +59,9 @@ public class TestMapFactory implements MapFactory {
throw new RuntimeException("Unsupported object class " + objectClass.toString());
}
@Override
public Compressor buildCompressor() {
return new CompressLZF();
}
}
......@@ -16,7 +16,6 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.h2.compress.CompressLZF;
import org.h2.compress.Compressor;
import org.h2.dev.store.FilePathCache;
import org.h2.store.fs.FilePath;
......@@ -116,7 +115,7 @@ public class MVStore {
private long retainVersion = -1;
private int retainChunk = -1;
private Compressor compressor = new CompressLZF();
private Compressor compressor;
private long currentVersion = 1;
private int readCount;
......@@ -125,6 +124,7 @@ public class MVStore {
private MVStore(String fileName, MapFactory mapFactory) {
this.fileName = fileName;
this.mapFactory = mapFactory;
this.compressor = mapFactory.buildCompressor();
}
/**
......@@ -943,14 +943,10 @@ public class MVStore {
return maxPageSize;
}
public Compressor getCompressor() {
Compressor getCompressor() {
return compressor;
}
public void setCompressor(Compressor compressor) {
this.compressor = compressor;
}
public boolean getReuseSpace() {
return reuseSpace;
}
......
......@@ -6,6 +6,8 @@
*/
package org.h2.dev.store.btree;
import org.h2.compress.Compressor;
/**
* A factory for maps and data types.
*/
......@@ -35,6 +37,13 @@ public interface MapFactory {
*/
DataType buildDataType(String dataType);
/**
* Create a new compressor.
*
* @return the compressor
*/
Compressor buildCompressor();
/**
* Get the data type object for the given class.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论