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:
...
@@ -107,7 +107,8 @@ MVStore:
- only retain the last version, unless explicitly set (setRetainVersion)
- only retain the last version, unless explicitly set (setRetainVersion)
- support opening (existing) maps by id
- support opening (existing) maps by id
- more consistent null handling (keys/values sometimes may be null)
- 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 {
...
@@ -140,7 +141,7 @@ public class MVStore {
private
final
String
fileName
;
private
final
String
fileName
;
private
final
char
[]
filePassword
;
private
final
char
[]
filePassword
;
private
int
pageSize
=
6
*
1024
;
private
final
int
pageSize
;
private
FileChannel
file
;
private
FileChannel
file
;
private
FileLock
fileLock
;
private
FileLock
fileLock
;
...
@@ -195,6 +196,8 @@ public class MVStore {
...
@@ -195,6 +196,8 @@ public class MVStore {
private
final
boolean
compress
;
private
final
boolean
compress
;
private
final
ExceptionListener
backgroundExceptionListener
;
private
long
currentVersion
;
private
long
currentVersion
;
/**
/**
...
@@ -236,8 +239,6 @@ public class MVStore {
...
@@ -236,8 +239,6 @@ public class MVStore {
*/
*/
private
int
writeDelay
=
1000
;
private
int
writeDelay
=
1000
;
private
ExceptionListener
backgroundExceptionListener
;
MVStore
(
HashMap
<
String
,
Object
>
config
)
{
MVStore
(
HashMap
<
String
,
Object
>
config
)
{
String
f
=
(
String
)
config
.
get
(
"fileName"
);
String
f
=
(
String
)
config
.
get
(
"fileName"
);
if
(
f
!=
null
&&
f
.
indexOf
(
':'
)
<
0
)
{
if
(
f
!=
null
&&
f
.
indexOf
(
':'
)
<
0
)
{
...
@@ -249,8 +250,12 @@ public class MVStore {
...
@@ -249,8 +250,12 @@ public class MVStore {
this
.
fileName
=
f
;
this
.
fileName
=
f
;
this
.
readOnly
=
config
.
containsKey
(
"readOnly"
);
this
.
readOnly
=
config
.
containsKey
(
"readOnly"
);
this
.
compress
=
config
.
containsKey
(
"compress"
);
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
)
{
if
(
fileName
!=
null
)
{
Object
o
=
config
.
get
(
"cacheSize"
);
o
=
config
.
get
(
"cacheSize"
);
int
mb
=
o
==
null
?
16
:
(
Integer
)
o
;
int
mb
=
o
==
null
?
16
:
(
Integer
)
o
;
int
maxMemoryBytes
=
mb
*
1024
*
1024
;
int
maxMemoryBytes
=
mb
*
1024
*
1024
;
int
averageMemory
=
pageSize
/
2
;
int
averageMemory
=
pageSize
/
2
;
...
@@ -1368,27 +1373,6 @@ public class MVStore {
...
@@ -1368,27 +1373,6 @@ public class MVStore {
// System.out.println(string);
// 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
()
{
Compressor
getCompressor
()
{
return
compressor
;
return
compressor
;
}
}
...
@@ -1397,6 +1381,10 @@ public class MVStore {
...
@@ -1397,6 +1381,10 @@ public class MVStore {
return
compress
;
return
compress
;
}
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
boolean
getReuseSpace
()
{
public
boolean
getReuseSpace
()
{
return
reuseSpace
;
return
reuseSpace
;
}
}
...
@@ -1459,21 +1447,6 @@ public class MVStore {
...
@@ -1459,21 +1447,6 @@ public class MVStore {
return
v
;
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
* Check whether all data can be read from this version. This requires that
* all chunks referenced by this version are still available (not
* all chunks referenced by this version are still available (not
...
@@ -2004,6 +1977,29 @@ public class MVStore {
...
@@ -2004,6 +1977,29 @@ public class MVStore {
return
set
(
"writeDelay"
,
millis
);
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.
* Open the store.
*
*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论