private ChunkKey endChunk(int typeCode) throws DhtException { ChunkFormatter w = openChunks[typeCode]; if (w == null) return null; openChunks[typeCode] = null; currChunk = null; if (w.isEmpty()) return null; ChunkKey key = w.end(chunkKeyDigest); ChunkInfo info = w.getChunkInfo(); if (chunkByOrder[typeCode] == null) chunkByOrder[typeCode] = new ArrayList<ChunkKey>(); chunkByOrder[typeCode].add(key); infoByKey.put(key, info); if (w.getChunkMeta() != null) chunkMeta.put(key, w.getChunkMeta()); Edges e = openEdges[typeCode]; if (e != null) { chunkEdges.put(key, e); openEdges[typeCode] = null; } if (currFragments == null) chunkReadBackCache.put(key, w.getPackChunk()); w.unsafePut(db, dbWriteBuffer); return key; }
private ChunkKey endChunk(int typeCode) throws DhtException { ChunkFormatter w = openChunks[typeCode]; if (w == null) return null; openChunks[typeCode] = null; currChunk = null; if (w.isEmpty()) return null; ChunkKey key = w.end(chunkKeyDigest); ChunkInfo info = w.getChunkInfo(); if (chunkByOrder[typeCode] == null) chunkByOrder[typeCode] = new ArrayList<ChunkKey>(); chunkByOrder[typeCode].add(key); infoByKey.put(key, info); if (w.getChunkMeta() != null) chunkMeta.put(key, w.getChunkMeta()); Edges e = openEdges[typeCode]; if (e != null) { chunkEdges.put(key, e); openEdges[typeCode] = null; } if (currFragments == null) chunkReadBackCache.put(key, w.getPackChunk()); w.unsafePut(db, dbWriteBuffer); return key; }
@Override public void flush() throws IOException { if (activeChunk != null && !activeChunk.isEmpty()) { activeChunk.end(digest()); activeChunk.safePut(db, dbBuffer()); activeChunk = null; } if (dbWriteBuffer != null) dbWriteBuffer.flush(); }
@Override public void flush() throws IOException { if (activeChunk != null && !activeChunk.isEmpty()) { activeChunk.end(digest()); activeChunk.safePut(db, dbBuffer()); activeChunk = null; } if (dbWriteBuffer != null) dbWriteBuffer.flush(); }
oe.setOffset(position); if (!chunk.isEmpty()) { packedSize += chunk.size(); chunk.setObjectType(type);
oe.setOffset(position); if (!chunk.isEmpty()) { packedSize += chunk.size(); chunk.setObjectType(type);
if (!activeChunk.isEmpty()) { activeChunk.end(digest()); activeChunk.safePut(db, dbBuffer());
if (!activeChunk.isEmpty()) { activeChunk.end(digest()); activeChunk.safePut(db, dbBuffer());