private void computeChunkEdges() throws DhtException { List<DhtInfo> objs = objectListByChunk; int beginIdx = 0; ChunkKey key = chunkOf(objs.get(0).chunkPtr); int type = typeOf(objs.get(0).chunkPtr); int objIdx = 1; for (; objIdx < objs.size(); objIdx++) { DhtInfo oe = objs.get(objIdx); ChunkKey oeKey = chunkOf(oe.chunkPtr); if (!key.equals(oeKey)) { computeEdges(objs.subList(beginIdx, objIdx), key, type); beginIdx = objIdx; key = oeKey; type = typeOf(oe.chunkPtr); } if (type != OBJ_MIXED && type != typeOf(oe.chunkPtr)) type = OBJ_MIXED; } computeEdges(objs.subList(beginIdx, objs.size()), key, type); }
private List<ChunkKey> toChunkList(Set<DhtInfo> objects) throws DhtException { if (objects == null || objects.isEmpty()) return null; Map<ChunkKey, ChunkOrderingEntry> map = new HashMap<ChunkKey, ChunkOrderingEntry>(); for (DhtInfo obj : objects) { if (!obj.isInPack()) continue; long chunkPtr = obj.chunkPtr; ChunkKey key = chunkOf(chunkPtr); ChunkOrderingEntry e = map.get(key); if (e == null) { e = new ChunkOrderingEntry(); e.key = key; e.order = chunkIdx(chunkPtr); map.put(key, e); } else { e.order = Math.min(e.order, chunkIdx(chunkPtr)); } } ChunkOrderingEntry[] tmp = map.values().toArray( new ChunkOrderingEntry[map.size()]); Arrays.sort(tmp); ChunkKey[] out = new ChunkKey[tmp.length]; for (int i = 0; i < tmp.length; i++) out[i] = tmp[i].key; return Arrays.asList(out); }
private List<ChunkKey> toChunkList(Set<DhtInfo> objects) throws DhtException { if (objects == null || objects.isEmpty()) return null; Map<ChunkKey, ChunkOrderingEntry> map = new HashMap<ChunkKey, ChunkOrderingEntry>(); for (DhtInfo obj : objects) { if (!obj.isInPack()) continue; long chunkPtr = obj.chunkPtr; ChunkKey key = chunkOf(chunkPtr); ChunkOrderingEntry e = map.get(key); if (e == null) { e = new ChunkOrderingEntry(); e.key = key; e.order = chunkIdx(chunkPtr); map.put(key, e); } else { e.order = Math.min(e.order, chunkIdx(chunkPtr)); } } ChunkOrderingEntry[] tmp = map.values().toArray( new ChunkOrderingEntry[map.size()]); Arrays.sort(tmp); ChunkKey[] out = new ChunkKey[tmp.length]; for (int i = 0; i < tmp.length; i++) out[i] = tmp[i].key; return Arrays.asList(out); }
private void computeChunkEdges() throws DhtException { List<DhtInfo> objs = objectListByChunk; int beginIdx = 0; ChunkKey key = chunkOf(objs.get(0).chunkPtr); int type = typeOf(objs.get(0).chunkPtr); int objIdx = 1; for (; objIdx < objs.size(); objIdx++) { DhtInfo oe = objs.get(objIdx); ChunkKey oeKey = chunkOf(oe.chunkPtr); if (!key.equals(oeKey)) { computeEdges(objs.subList(beginIdx, objIdx), key, type); beginIdx = objIdx; key = oeKey; type = typeOf(oe.chunkPtr); } if (type != OBJ_MIXED && type != typeOf(oe.chunkPtr)) type = OBJ_MIXED; } computeEdges(objs.subList(beginIdx, objs.size()), key, type); }
private ObjectTypeAndSize seekDatabase(long chunkPtr, ObjectTypeAndSize info) throws DhtException { seekChunk(chunkOf(chunkPtr), true); dbPtr = dbChunk.readObjectTypeAndSize(offsetOf(chunkPtr), info); return info; }
private ObjectTypeAndSize seekDatabase(long chunkPtr, ObjectTypeAndSize info) throws DhtException { seekChunk(chunkOf(chunkPtr), true); dbPtr = dbChunk.readObjectTypeAndSize(offsetOf(chunkPtr), info); return info; }
private Edges edges(long chunkPtr) throws DhtException { if (isInCurrentChunk(chunkPtr)) { int type = typeOf(chunkPtr); Edges s = openEdges[type]; if (s == null) { s = new Edges(); openEdges[type] = s; } return s; } else { ChunkKey key = chunkOf(chunkPtr); Edges s = chunkEdges.get(key); if (s == null) { s = new Edges(); chunkEdges.put(key, s); } return s; } }
private Edges edges(long chunkPtr) throws DhtException { if (isInCurrentChunk(chunkPtr)) { int type = typeOf(chunkPtr); Edges s = openEdges[type]; if (s == null) { s = new Edges(); openEdges[type] = s; } return s; } else { ChunkKey key = chunkOf(chunkPtr); Edges s = chunkEdges.get(key); if (s == null) { s = new Edges(); chunkEdges.put(key, s); } return s; } }
private void putChunkIndexes() throws DhtException { List<DhtInfo> objs = objectListByChunk; int sIdx = 0; DhtInfo oe = objs.get(0); oe.setOffset(offsetOf(oe.chunkPtr)); ChunkKey key = chunkOf(oe.chunkPtr); int type = typeOf(oe.chunkPtr); int objIdx = 1; for (; objIdx < objs.size(); objIdx++) { oe = objs.get(objIdx); oe.setOffset(offsetOf(oe.chunkPtr)); ChunkKey oeKey = chunkOf(oe.chunkPtr); if (!key.equals(oeKey)) { putChunkIndex(objs.subList(sIdx, objIdx), key, type); sIdx = objIdx; key = oeKey; type = typeOf(oe.chunkPtr); } if (type != OBJ_MIXED && type != typeOf(oe.chunkPtr)) type = OBJ_MIXED; } putChunkIndex(objs.subList(sIdx, objs.size()), key, type); }
private void putChunkIndexes() throws DhtException { List<DhtInfo> objs = objectListByChunk; int sIdx = 0; DhtInfo oe = objs.get(0); oe.setOffset(offsetOf(oe.chunkPtr)); ChunkKey key = chunkOf(oe.chunkPtr); int type = typeOf(oe.chunkPtr); int objIdx = 1; for (; objIdx < objs.size(); objIdx++) { oe = objs.get(objIdx); oe.setOffset(offsetOf(oe.chunkPtr)); ChunkKey oeKey = chunkOf(oe.chunkPtr); if (!key.equals(oeKey)) { putChunkIndex(objs.subList(sIdx, objIdx), key, type); sIdx = objIdx; key = oeKey; type = typeOf(oe.chunkPtr); } if (type != OBJ_MIXED && type != typeOf(oe.chunkPtr)) type = OBJ_MIXED; } putChunkIndex(objs.subList(sIdx, objs.size()), key, type); }
oe.info(chunkOf(oe.chunkPtr)), // dbWriteBuffer); cnt++;
oe.info(chunkOf(oe.chunkPtr)), // dbWriteBuffer); cnt++;
chunkOf(oe.chunkPtr), // dbWriteBuffer); cnt++;
chunkOf(oe.chunkPtr), // dbWriteBuffer); cnt++;