boolean contains(RepositoryKey repo, AnyObjectId objId) { return 0 <= findOffset(repo, objId); }
boolean contains(RepositoryKey repo, AnyObjectId objId) { return 0 <= findOffset(repo, objId); }
boolean has(RepositoryKey repo, AnyObjectId objId) { for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return true; } } return false; }
boolean has(RepositoryKey repo, AnyObjectId objId) { for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return true; } } return false; }
synchronized ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) { for (PackChunk c : ready.values()) { int p = c.findOffset(repo, objId); if (0 <= p) return new ChunkAndOffset(useReadyChunk(c.getChunkKey()), p); } return null; }
synchronized ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) { for (PackChunk c : ready.values()) { int p = c.findOffset(repo, objId); if (0 <= p) return new ChunkAndOffset(useReadyChunk(c.getChunkKey()), p); } return null; }
ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) { if (objId instanceof IdWithChunk) { PackChunk chunk = get(((IdWithChunk) objId).getChunkKey()); if (chunk != null) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return new ChunkAndOffset(chunk, pos); } // IdWithChunk is only a hint, and can be wrong. Locally // searching is faster than looking in the Database. } for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return new ChunkAndOffset(n.chunk, pos); } } return null; }
ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) { if (objId instanceof IdWithChunk) { PackChunk chunk = get(((IdWithChunk) objId).getChunkKey()); if (chunk != null) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return new ChunkAndOffset(chunk, pos); } // IdWithChunk is only a hint, and can be wrong. Locally // searching is faster than looking in the Database. } for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return new ChunkAndOffset(n.chunk, pos); } } return null; }
ObjectLoader open(RepositoryKey repo, AnyObjectId objId, int typeHint) throws IOException { if (objId instanceof IdWithChunk) { PackChunk chunk = get(((IdWithChunk) objId).getChunkKey()); if (chunk != null) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return PackChunk.read(chunk, pos, reader, typeHint); } // IdWithChunk is only a hint, and can be wrong. Locally // searching is faster than looking in the Database. } for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return PackChunk.read(n.chunk, pos, reader, typeHint); } } return null; }
ObjectLoader open(RepositoryKey repo, AnyObjectId objId, int typeHint) throws IOException { if (objId instanceof IdWithChunk) { PackChunk chunk = get(((IdWithChunk) objId).getChunkKey()); if (chunk != null) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return PackChunk.read(chunk, pos, reader, typeHint); } // IdWithChunk is only a hint, and can be wrong. Locally // searching is faster than looking in the Database. } for (Node n = lruHead; n != null; n = n.next) { int pos = n.chunk.findOffset(repo, objId); if (0 <= pos) { hit(n); stats.recentChunks_Hits++; return PackChunk.read(n.chunk, pos, reader, typeHint); } } return null; }
public ObjectLoader open() throws IOException { ChunkKey chunkKey = current.chunkKey; // Objects returned by the queue are clustered by chunk. This object // is either in the current chunk, or are the next chunk ready on the // prefetcher. Anything else is a programming error. // PackChunk chunk; if (currChunk != null && chunkKey.equals(currChunk.getChunkKey())) chunk = currChunk; else { chunk = prefetcher.get(chunkKey); if (chunk == null) throw new DhtMissingChunkException(chunkKey); currChunk = chunk; reader.recentChunk(chunk); } if (current.info != null) { int ptr = current.info.getOffset(); int type = current.info.getType(); return PackChunk.read(chunk, ptr, reader, type); } else { int ptr = chunk.findOffset(repo, current.object); if (ptr < 0) throw DhtReader.missing(current.object, ObjectReader.OBJ_ANY); return PackChunk.read(chunk, ptr, reader, ObjectReader.OBJ_ANY); } }
public ObjectLoader open() throws IOException { ChunkKey chunkKey = current.chunkKey; // Objects returned by the queue are clustered by chunk. This object // is either in the current chunk, or are the next chunk ready on the // prefetcher. Anything else is a programming error. // PackChunk chunk; if (currChunk != null && chunkKey.equals(currChunk.getChunkKey())) chunk = currChunk; else { chunk = prefetcher.get(chunkKey); if (chunk == null) throw new DhtMissingChunkException(chunkKey); currChunk = chunk; reader.recentChunk(chunk); } if (current.info != null) { int ptr = current.info.getOffset(); int type = current.info.getType(); return PackChunk.read(chunk, ptr, reader, type); } else { int ptr = chunk.findOffset(repo, current.object); if (ptr < 0) throw DhtReader.missing(current.object, ObjectReader.OBJ_ANY); return PackChunk.read(chunk, ptr, reader, ObjectReader.OBJ_ANY); } }
PackChunk chunk = load(key); if (chunk != null && chunk.hasIndex()) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return new ChunkAndOffset(chunk, pos);
PackChunk chunk = load(key); if (chunk != null && chunk.hasIndex()) { int pos = chunk.findOffset(repo, objId); if (0 <= pos) return new ChunkAndOffset(chunk, pos);