Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1dfdeea0
提交
1dfdeea0
authored
7月 31, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move page size to the builder
上级
319b2f56
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
41 行删除
+37
-41
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+37
-41
没有找到文件。
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
1dfdeea0
...
...
@@ -107,7 +107,8 @@ MVStore:
- only retain the last version, unless explicitly set (setRetainVersion)
- support opening (existing) maps by id
- more consistent null handling (keys/values sometimes may be null)
- logging mechanism, specially for operations in a background thread
- autocommit (to avoid having to call commit,
as it could be called too often or it is easily forgotten)
*/
...
...
@@ -140,7 +141,7 @@ public class MVStore {
private
final
String
fileName
;
private
final
char
[]
filePassword
;
private
int
pageSize
=
6
*
1024
;
private
final
int
pageSize
;
private
FileChannel
file
;
private
FileLock
fileLock
;
...
...
@@ -194,6 +195,8 @@ public class MVStore {
private
final
Compressor
compressor
=
new
CompressLZF
();
private
final
boolean
compress
;
private
final
ExceptionListener
backgroundExceptionListener
;
private
long
currentVersion
;
...
...
@@ -236,8 +239,6 @@ public class MVStore {
*/
private
int
writeDelay
=
1000
;
private
ExceptionListener
backgroundExceptionListener
;
MVStore
(
HashMap
<
String
,
Object
>
config
)
{
String
f
=
(
String
)
config
.
get
(
"fileName"
);
if
(
f
!=
null
&&
f
.
indexOf
(
':'
)
<
0
)
{
...
...
@@ -249,8 +250,12 @@ public class MVStore {
this
.
fileName
=
f
;
this
.
readOnly
=
config
.
containsKey
(
"readOnly"
);
this
.
compress
=
config
.
containsKey
(
"compress"
);
Object
o
=
config
.
get
(
"pageSize"
);
pageSize
=
o
==
null
?
6
*
1024
:
(
Integer
)
o
;
o
=
config
.
get
(
"backgroundExceptionListener"
);
this
.
backgroundExceptionListener
=
(
ExceptionListener
)
o
;
if
(
fileName
!=
null
)
{
Object
o
=
config
.
get
(
"cacheSize"
);
o
=
config
.
get
(
"cacheSize"
);
int
mb
=
o
==
null
?
16
:
(
Integer
)
o
;
int
maxMemoryBytes
=
mb
*
1024
*
1024
;
int
averageMemory
=
pageSize
/
2
;
...
...
@@ -1368,27 +1373,6 @@ public class MVStore {
// System.out.println(string);
}
/**
* Set the amount of memory a page should contain at most, in bytes. Larger
* pages are split. The default is 6 KB. This is not a limit in the page
* size (pages with one entry can get larger), it is just the point where
* pages are split.
*
* @param pageSize the page size
*/
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
/**
* Get the page size, in bytes.
*
* @return the page size
*/
public
int
getPageSize
()
{
return
pageSize
;
}
Compressor
getCompressor
()
{
return
compressor
;
}
...
...
@@ -1396,6 +1380,10 @@ public class MVStore {
boolean
getCompress
()
{
return
compress
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
boolean
getReuseSpace
()
{
return
reuseSpace
;
...
...
@@ -1459,21 +1447,6 @@ public class MVStore {
return
v
;
}
/**
* Set the listener to be used for exceptions that occur in the background
* thread.
*
* @param backgroundExceptionListener the listener
*/
public
void
setBackgroundExceptionListener
(
ExceptionListener
backgroundExceptionListener
)
{
this
.
backgroundExceptionListener
=
backgroundExceptionListener
;
}
public
ExceptionListener
getBackgroundExceptionListener
()
{
return
backgroundExceptionListener
;
}
/**
* Check whether all data can be read from this version. This requires that
* all chunks referenced by this version are still available (not
...
...
@@ -2004,6 +1977,29 @@ public class MVStore {
return
set
(
"writeDelay"
,
millis
);
}
/**
* Set the amount of memory a page should contain at most, in bytes. Larger
* pages are split. The default is 6 KB. This is not a limit in the page
* size (pages with one entry can get larger), it is just the point where
* pages are split.
*
* @param pageSize the page size
*/
public
Builder
pageSize
(
int
pageSize
)
{
return
set
(
"pageSize"
,
pageSize
);
}
/**
* Set the listener to be used for exceptions that occur in the background
* thread.
*
* @param backgroundExceptionListener the listener
*/
public
Builder
backgroundExceptionListener
(
ExceptionListener
backgroundExceptionListener
)
{
return
set
(
"backgroundExceptionListener"
,
backgroundExceptionListener
);
}
/**
* Open the store.
*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论