RecentChunks(DhtReader reader) { this.reader = reader; this.stats = reader.getStatistics(); this.byKey = new HashMap<ChunkKey, Node>(); this.maxBytes = reader.getOptions().getChunkLimit(); }
RecentChunks(DhtReader reader) { this.reader = reader; this.stats = reader.getStatistics(); this.byKey = new HashMap<ChunkKey, Node>(); this.maxBytes = reader.getOptions().getChunkLimit(); }
private Prefetcher prefetch(final int type, final int ratio) { int limit = readerOptions.getChunkLimit(); int prefetchLimit = (int) (limit * (ratio / 100.0)); recentChunks.setMaxBytes(limit - prefetchLimit); return new Prefetcher(this, type, prefetchLimit); }
private void endPrefetch() { recentChunks.setMaxBytes(getOptions().getChunkLimit()); prefetcher = null; }
private Prefetcher prefetch(final int type, final int ratio) { int limit = readerOptions.getChunkLimit(); int prefetchLimit = (int) (limit * (ratio / 100.0)); recentChunks.setMaxBytes(limit - prefetchLimit); return new Prefetcher(this, type, prefetchLimit); }
private void endPrefetch() { recentChunks.setMaxBytes(getOptions().getChunkLimit()); prefetcher = null; }
@Override public void release() { reader.getRecentChunks().setMaxBytes(reader.getOptions().getChunkLimit()); prefetcher = null; currChunk = null; }
@Override public void release() { reader.getRecentChunks().setMaxBytes(reader.getOptions().getChunkLimit()); prefetcher = null; currChunk = null; }
private void init() throws IOException { ObjectWithInfo<T> c; while ((c = nextObjectWithInfo()) != null) { ChunkKey chunkKey = c.chunkKey; Collection<ObjectWithInfo<T>> list = byChunk.get(chunkKey); if (list == null) { list = new ArrayList<ObjectWithInfo<T>>(); byChunk.put(chunkKey, list); if (prefetcher == null) { int limit = reader.getOptions().getChunkLimit(); int ratio = reader.getOptions().getOpenQueuePrefetchRatio(); int prefetchLimit = (int) (limit * (ratio / 100.0)); reader.getRecentChunks().setMaxBytes(limit - prefetchLimit); prefetcher = new Prefetcher(reader, 0, prefetchLimit); } prefetcher.push(chunkKey); } list.add(c); } chunkItr = byChunk.values().iterator(); } }
private void init() throws IOException { ObjectWithInfo<T> c; while ((c = nextObjectWithInfo()) != null) { ChunkKey chunkKey = c.chunkKey; Collection<ObjectWithInfo<T>> list = byChunk.get(chunkKey); if (list == null) { list = new ArrayList<ObjectWithInfo<T>>(); byChunk.put(chunkKey, list); if (prefetcher == null) { int limit = reader.getOptions().getChunkLimit(); int ratio = reader.getOptions().getOpenQueuePrefetchRatio(); int prefetchLimit = (int) (limit * (ratio / 100.0)); reader.getRecentChunks().setMaxBytes(limit - prefetchLimit); prefetcher = new Prefetcher(reader, 0, prefetchLimit); } prefetcher.push(chunkKey); } list.add(c); } chunkItr = byChunk.values().iterator(); } }
void copyAsIs(PackOutputStream out, boolean validate, DhtReader ctx) throws IOException { if (keyList == null) init(); // Clear the recent chunks because all of the reader's // chunk limit should be made available for prefetch. int cacheLimit = ctx.getOptions().getChunkLimit(); ctx.getRecentChunks().setMaxBytes(0); try { Prefetcher p = new Prefetcher(ctx, 0, cacheLimit); p.push(Arrays.asList(keyList)); copyPack(out, p, validate); } finally { ctx.getRecentChunks().setMaxBytes(cacheLimit); } }
void copyAsIs(PackOutputStream out, boolean validate, DhtReader ctx) throws IOException { if (keyList == null) init(); // Clear the recent chunks because all of the reader's // chunk limit should be made available for prefetch. int cacheLimit = ctx.getOptions().getChunkLimit(); ctx.getRecentChunks().setMaxBytes(0); try { Prefetcher p = new Prefetcher(ctx, 0, cacheLimit); p.push(Arrays.asList(keyList)); copyPack(out, p, validate); } finally { ctx.getRecentChunks().setMaxBytes(cacheLimit); } }
setTimeout(Timeout.getTimeout(rc, "core", "dht", "timeout", getTimeout())); setPrefetchFollowEdgeHints(rc.getBoolean("core", "dht", "prefetchFollowEdgeHints", isPrefetchFollowEdgeHints())); setChunkLimit(rc.getInt("core", "dht", "chunkLimit", getChunkLimit())); setOpenQueuePrefetchRatio(rc.getInt("core", "dht", "openQueuePrefetchRatio", getOpenQueuePrefetchRatio())); setWalkCommitsPrefetchRatio(rc.getInt("core", "dht", "walkCommitsPrefetchRatio", getWalkCommitsPrefetchRatio()));
setTimeout(Timeout.getTimeout(rc, "core", "dht", "timeout", getTimeout())); setPrefetchFollowEdgeHints(rc.getBoolean("core", "dht", "prefetchFollowEdgeHints", isPrefetchFollowEdgeHints())); setChunkLimit(rc.getInt("core", "dht", "chunkLimit", getChunkLimit())); setOpenQueuePrefetchRatio(rc.getInt("core", "dht", "openQueuePrefetchRatio", getOpenQueuePrefetchRatio())); setWalkCommitsPrefetchRatio(rc.getInt("core", "dht", "walkCommitsPrefetchRatio", getWalkCommitsPrefetchRatio()));