private boolean longOfsDelta(ChunkFormatter w, long infSize, long basePtr) { final int type = typeOf(basePtr); final List<ChunkKey> infoList = chunkByOrder[type]; final int baseIdx = chunkIdx(basePtr); final ChunkInfo baseInfo = infoByKey.get(infoList.get(baseIdx)); // Go backwards to the start of the base's chunk. long relativeChunkStart = 0; for (int i = infoList.size() - 1; baseIdx <= i; i--) { GitStore.ChunkInfo info = infoByKey.get(infoList.get(i)).getData(); int packSize = info.getChunkSize() - ChunkFormatter.TRAILER_SIZE; relativeChunkStart += packSize; } // Offset to the base goes back to start of our chunk, then start of // the base chunk, but slide forward the distance of the base within // its own chunk. // long ofs = w.position() + relativeChunkStart - offsetOf(basePtr); if (w.ofsDelta(infSize, ofs)) { w.useBaseChunk(relativeChunkStart, baseInfo.getChunkKey()); return true; } return false; }
private boolean longOfsDelta(ChunkFormatter w, long infSize, long basePtr) { final int type = typeOf(basePtr); final List<ChunkKey> infoList = chunkByOrder[type]; final int baseIdx = chunkIdx(basePtr); final ChunkInfo baseInfo = infoByKey.get(infoList.get(baseIdx)); // Go backwards to the start of the base's chunk. long relativeChunkStart = 0; for (int i = infoList.size() - 1; baseIdx <= i; i--) { GitStore.ChunkInfo info = infoByKey.get(infoList.get(i)).getData(); int packSize = info.getChunkSize() - ChunkFormatter.TRAILER_SIZE; relativeChunkStart += packSize; } // Offset to the base goes back to start of our chunk, then start of // the base chunk, but slide forward the distance of the base within // its own chunk. // long ofs = w.position() + relativeChunkStart - offsetOf(basePtr); if (w.ofsDelta(infSize, ofs)) { w.useBaseChunk(relativeChunkStart, baseInfo.getChunkKey()); return true; } return false; }
hash = (53 * hash) + getChunkSize();
result = result && (getChunkSize() == other.getChunkSize());
result = result && (getChunkSize() == other.getChunkSize());
hash = (53 * hash) + getChunkSize();
public Builder mergeFrom(org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo other) { if (other == org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo.getDefaultInstance()) return this; if (other.hasSource()) { setSource(other.getSource()); } if (other.hasObjectType()) { setObjectType(other.getObjectType()); } if (other.hasIsFragment()) { setIsFragment(other.getIsFragment()); } if (other.hasCachedPackKey()) { setCachedPackKey(other.getCachedPackKey()); } if (other.hasObjectCounts()) { mergeObjectCounts(other.getObjectCounts()); } if (other.hasChunkSize()) { setChunkSize(other.getChunkSize()); } if (other.hasIndexSize()) { setIndexSize(other.getIndexSize()); } if (other.hasMetaSize()) { setMetaSize(other.getMetaSize()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo other) { if (other == org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo.getDefaultInstance()) return this; if (other.hasSource()) { setSource(other.getSource()); } if (other.hasObjectType()) { setObjectType(other.getObjectType()); } if (other.hasIsFragment()) { setIsFragment(other.getIsFragment()); } if (other.hasCachedPackKey()) { setCachedPackKey(other.getCachedPackKey()); } if (other.hasObjectCounts()) { mergeObjectCounts(other.getObjectCounts()); } if (other.hasChunkSize()) { setChunkSize(other.getChunkSize()); } if (other.hasIndexSize()) { setIndexSize(other.getIndexSize()); } if (other.hasMetaSize()) { setMetaSize(other.getMetaSize()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
private void addChunkList(CachedPackInfo.Builder info, MessageDigest version, List<ChunkKey> list) { if (list == null) return; long bytesTotal = info.getBytesTotal(); long objectsTotal = info.getObjectsTotal(); long objectsDelta = info.getObjectsDelta(); byte[] buf = new byte[Constants.OBJECT_ID_LENGTH]; for (ChunkKey key : list) { ChunkInfo chunkInfo = infoByKey.get(key); GitStore.ChunkInfo c = chunkInfo.getData(); int len = c.getChunkSize() - ChunkFormatter.TRAILER_SIZE; bytesTotal += len; objectsTotal += c.getObjectCounts().getTotal(); objectsDelta += c.getObjectCounts().getOfsDelta(); objectsDelta += c.getObjectCounts().getRefDelta(); info.getChunkListBuilder().addChunkKey( chunkInfo.getChunkKey().asString()); chunkInfo.getChunkKey().getChunkHash().copyRawTo(buf, 0); version.update(buf); } info.setBytesTotal(bytesTotal); info.setObjectsTotal(objectsTotal); info.setObjectsDelta(objectsDelta); }
private void addChunkList(CachedPackInfo.Builder info, MessageDigest version, List<ChunkKey> list) { if (list == null) return; long bytesTotal = info.getBytesTotal(); long objectsTotal = info.getObjectsTotal(); long objectsDelta = info.getObjectsDelta(); byte[] buf = new byte[Constants.OBJECT_ID_LENGTH]; for (ChunkKey key : list) { ChunkInfo chunkInfo = infoByKey.get(key); GitStore.ChunkInfo c = chunkInfo.getData(); int len = c.getChunkSize() - ChunkFormatter.TRAILER_SIZE; bytesTotal += len; objectsTotal += c.getObjectCounts().getTotal(); objectsDelta += c.getObjectCounts().getOfsDelta(); objectsDelta += c.getObjectCounts().getRefDelta(); info.getChunkListBuilder().addChunkKey( chunkInfo.getChunkKey().asString()); chunkInfo.getChunkKey().getChunkHash().copyRawTo(buf, 0); version.update(buf); } info.setBytesTotal(bytesTotal); info.setObjectsTotal(objectsTotal); info.setObjectsDelta(objectsDelta); }