PackChunk get(ChunkKey key) { Node n = byKey.get(key); if (n != null) { hit(n); stats.recentChunks_Hits++; return n.chunk; } stats.recentChunks_Miss++; return null; }
PackChunk get(ChunkKey key) { Node n = byKey.get(key); if (n != null) { hit(n); stats.recentChunks_Hits++; return n.chunk; } stats.recentChunks_Miss++; return null; }
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; }
void put(PackChunk chunk) { Node n = byKey.get(chunk.getChunkKey()); if (n != null && n.chunk == chunk) { hit(n); return; } curBytes += chunk.getTotalSize(); prune(); n = new Node(); n.chunk = chunk; byKey.put(chunk.getChunkKey(), n); first(n); }
void put(PackChunk chunk) { Node n = byKey.get(chunk.getChunkKey()); if (n != null && n.chunk == chunk) { hit(n); return; } curBytes += chunk.getTotalSize(); prune(); n = new Node(); n.chunk = chunk; byKey.put(chunk.getChunkKey(), n); first(n); }
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; }
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; }