提交 5a2ea19a authored 作者: Noel Grandin's avatar Noel Grandin

improve field names in ChunkIdsCollector

上级 0ff4499b
...@@ -1377,7 +1377,7 @@ public class MVStore { ...@@ -1377,7 +1377,7 @@ public class MVStore {
final class ChunkIdsCollector { final class ChunkIdsCollector {
private final Set<Integer> referenced = new HashSet<>(); private final Set<Integer> referencedChunks = new HashSet<>();
private final ChunkIdsCollector parent; private final ChunkIdsCollector parent;
private ChunkIdsCollector child; private ChunkIdsCollector child;
private int mapId; private int mapId;
...@@ -1404,13 +1404,13 @@ public class MVStore { ...@@ -1404,13 +1404,13 @@ public class MVStore {
} }
public Set<Integer> getReferenced() { public Set<Integer> getReferenced() {
return referenced; return referencedChunks;
} }
public void visit(Page page) { public void visit(Page page) {
long pos = page.getPos(); long pos = page.getPos();
if (DataUtils.isPageSaved(pos)) { if (DataUtils.isPageSaved(pos)) {
register(DataUtils.getPageChunkId(pos)); registerChunk(DataUtils.getPageChunkId(pos));
} }
int count = page.map.getChildPageCount(page); int count = page.map.getChildPageCount(page);
if (count > 0) { if (count > 0) {
...@@ -1435,13 +1435,13 @@ public class MVStore { ...@@ -1435,13 +1435,13 @@ public class MVStore {
if (!DataUtils.isPageSaved(pos)) { if (!DataUtils.isPageSaved(pos)) {
return; return;
} }
register(DataUtils.getPageChunkId(pos)); registerChunk(DataUtils.getPageChunkId(pos));
if (DataUtils.getPageType(pos) != DataUtils.PAGE_TYPE_LEAF) { if (DataUtils.getPageType(pos) != DataUtils.PAGE_TYPE_LEAF) {
int chunkIds[]; int chunkIds[];
if (cacheChunkRef != null && (chunkIds = cacheChunkRef.get(pos)) != null) { if (cacheChunkRef != null && (chunkIds = cacheChunkRef.get(pos)) != null) {
// there is a cached set of chunk ids for this position // there is a cached set of chunk ids for this position
for (int chunkId : chunkIds) { for (int chunkId : chunkIds) {
register(chunkId); registerChunk(chunkId);
} }
} else { } else {
ChunkIdsCollector childCollector = getChild(); ChunkIdsCollector childCollector = getChild();
...@@ -1475,21 +1475,21 @@ public class MVStore { ...@@ -1475,21 +1475,21 @@ public class MVStore {
if (child == null) { if (child == null) {
child = new ChunkIdsCollector(this); child = new ChunkIdsCollector(this);
} else { } else {
child.referenced.clear(); child.referencedChunks.clear();
} }
return child; return child;
} }
private void register(int chunkId) { private void registerChunk(int chunkId) {
if (referenced.add(chunkId) && parent != null) { if (referencedChunks.add(chunkId) && parent != null) {
parent.register(chunkId); parent.registerChunk(chunkId);
} }
} }
private int[] getChunkIds() { private int[] getChunkIds() {
int chunkIds[] = new int[referenced.size()]; int chunkIds[] = new int[referencedChunks.size()];
int index = 0; int index = 0;
for (int chunkId : referenced) { for (int chunkId : referencedChunks) {
chunkIds[index++] = chunkId; chunkIds[index++] = chunkId;
} }
return chunkIds; return chunkIds;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论