Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f125a8a4
提交
f125a8a4
authored
6 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
javadoc in MVStore
上级
b1841c5f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
51 行增加
和
0 行删除
+51
-0
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+51
-0
没有找到文件。
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
f125a8a4
...
...
@@ -529,6 +529,14 @@ public class MVStore implements AutoCloseable {
}
}
/**
* Get map by id.
*
* @param <K> the key type
* @param <V> the value type
* @param id map id
* @return Map
*/
public
<
K
,
V
>
MVMap
<
K
,
V
>
getMap
(
int
id
)
{
checkOpen
();
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -609,6 +617,12 @@ public class MVStore implements AutoCloseable {
return
meta
.
containsKey
(
"name."
+
name
);
}
/**
* Check whether a given map exists and has data.
*
* @param name the map name
* @return true if it exists and has data.
*/
public
boolean
hasData
(
String
name
)
{
return
hasMap
(
name
)
&&
getRootPos
(
meta
,
getMapId
(
name
))
!=
0
;
}
...
...
@@ -969,6 +983,13 @@ public class MVStore implements AutoCloseable {
}
}
/**
* Read a page of data into a ByteBuffer.
*
* @param pos page pos
* @param expectedMapId expected map id for the page
* @return ByteBuffer containing page data.
*/
ByteBuffer
readBufferForPage
(
long
pos
,
int
expectedMapId
)
{
Chunk
c
=
getChunk
(
pos
);
long
filePos
=
c
.
block
*
BLOCK_SIZE
;
...
...
@@ -1493,6 +1514,13 @@ public class MVStore implements AutoCloseable {
return
new
HashSet
<>(
referencedChunks
.
keySet
());
}
/**
* Visit a page on a chunk and collect ids for it and its children.
*
* @param page the page to visit
* @param executorService the service to use when doing visit in parallel
* @param executingThreadCounter number of threads currently active
*/
public
void
visit
(
Page
page
,
ThreadPoolExecutor
executorService
,
AtomicInteger
executingThreadCounter
)
{
long
pos
=
page
.
getPos
();
if
(
DataUtils
.
isPageSaved
(
pos
))
{
...
...
@@ -1515,6 +1543,13 @@ public class MVStore implements AutoCloseable {
cacheCollectedChunkIds
(
pos
,
childCollector
);
}
/**
* Visit a page on a chunk and collect ids for it and its children.
*
* @param pos position of the page to visit
* @param executorService the service to use when doing visit in parallel
* @param executingThreadCounter number of threads currently active
*/
public
void
visit
(
long
pos
,
ThreadPoolExecutor
executorService
,
AtomicInteger
executingThreadCounter
)
{
if
(!
DataUtils
.
isPageSaved
(
pos
))
{
return
;
...
...
@@ -1544,6 +1579,11 @@ public class MVStore implements AutoCloseable {
}
}
/**
* Add chunk to list of referenced chunks.
*
* @param chunkId chunk id
*/
void
registerChunk
(
int
chunkId
)
{
if
(
referencedChunks
.
put
(
chunkId
,
1
)
==
null
&&
parent
!=
null
)
{
parent
.
registerChunk
(
chunkId
);
...
...
@@ -2603,6 +2643,12 @@ public class MVStore implements AutoCloseable {
removeMap
(
map
,
true
);
}
/**
* Remove a map.
*
* @param map the map to remove
* @param delayed whether to delay deleting the metadata
*/
public
void
removeMap
(
MVMap
<?,
?>
map
,
boolean
delayed
)
{
storeLock
.
lock
();
try
{
...
...
@@ -2637,6 +2683,11 @@ public class MVStore implements AutoCloseable {
}
}
/**
* Remove map by name.
*
* @param name the map name
*/
public
void
removeMap
(
String
name
)
{
int
id
=
getMapId
(
name
);
if
(
id
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论