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 computeEdges(List<DhtInfo> objs, ChunkKey key, int type) throws DhtException { Edges edges = chunkEdges.get(key); if (edges == null) return; for (DhtInfo obj : objs) edges.remove(obj); switch (type) { case OBJ_COMMIT: edges.commitEdges = toChunkList(edges.commitIds); break; case OBJ_TREE: // TODO prefetch tree edges break; } edges.commitIds = null; }
private void computeEdges(List<DhtInfo> objs, ChunkKey key, int type) throws DhtException { Edges edges = chunkEdges.get(key); if (edges == null) return; for (DhtInfo obj : objs) edges.remove(obj); switch (type) { case OBJ_COMMIT: edges.commitEdges = toChunkList(edges.commitIds); break; case OBJ_TREE: // TODO prefetch tree edges break; } edges.commitIds = null; }
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 onCommit(DhtInfo obj, byte[] raw) throws DhtException { Edges edges = edges(obj.chunkPtr); edges.remove(obj); // TODO compute hints for trees. if (isSaveAsCachedPack()) { idBuffer.fromString(raw, 5); lookupByName(idBuffer).setReferenced(); } int ptr = 46; while (raw[ptr] == 'p') { idBuffer.fromString(raw, ptr + 7); DhtInfo p = lookupByName(idBuffer); p.setReferenced(); edges.commit(p); ptr += 48; } }
private void onCommit(DhtInfo obj, byte[] raw) throws DhtException { Edges edges = edges(obj.chunkPtr); edges.remove(obj); // TODO compute hints for trees. if (isSaveAsCachedPack()) { idBuffer.fromString(raw, 5); lookupByName(idBuffer).setReferenced(); } int ptr = 46; while (raw[ptr] == 'p') { idBuffer.fromString(raw, ptr + 7); DhtInfo p = lookupByName(idBuffer); p.setReferenced(); edges.commit(p); ptr += 48; } }