ChunkKey getChunkKey() { return getChunkInfo().getChunkKey(); }
ChunkKey getChunkKey() { return getChunkInfo().getChunkKey(); }
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; }
void unsafePut(Database db, WriteBuffer dbWriteBuffer) throws DhtException { db.repository().put(repo, getChunkInfo(), dbWriteBuffer); db.chunk().put(builder, dbWriteBuffer); linkObjects(db, dbWriteBuffer); }
void unsafePut(Database db, WriteBuffer dbWriteBuffer) throws DhtException { db.repository().put(repo, getChunkInfo(), dbWriteBuffer); db.chunk().put(builder, dbWriteBuffer); linkObjects(db, dbWriteBuffer); }
/** * Safely put the chunk to the database. * <p> * This method is slow. It first puts the chunk info, waits for success, * then puts the chunk itself, waits for success, and finally queues up the * object index with its chunk links in the supplied buffer. * * @param db * @param dbWriteBuffer * @throws DhtException */ void safePut(Database db, WriteBuffer dbWriteBuffer) throws DhtException { WriteBuffer chunkBuf = db.newWriteBuffer(); db.repository().put(repo, getChunkInfo(), chunkBuf); chunkBuf.flush(); db.chunk().put(builder, chunkBuf); chunkBuf.flush(); linkObjects(db, dbWriteBuffer); }
/** * Safely put the chunk to the database. * <p> * This method is slow. It first puts the chunk info, waits for success, * then puts the chunk itself, waits for success, and finally queues up the * object index with its chunk links in the supplied buffer. * * @param db * @param dbWriteBuffer * @throws DhtException */ void safePut(Database db, WriteBuffer dbWriteBuffer) throws DhtException { WriteBuffer chunkBuf = db.newWriteBuffer(); db.repository().put(repo, getChunkInfo(), chunkBuf); chunkBuf.flush(); db.chunk().put(builder, chunkBuf); chunkBuf.flush(); linkObjects(db, dbWriteBuffer); }