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; }
ChunkInfo oldInfo = infoByKey.get(key); GitStore.ChunkInfo.Builder info = GitStore.ChunkInfo.newBuilder(oldInfo.getData());
public org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo buildPartial() { org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo result = new org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
ChunkKey key = ChunkKey.create(repo, ObjectId.fromRaw(md.digest())); GitStore.ChunkInfo.Builder info = GitStore.ChunkInfo.newBuilder(); info.setSource(source); info.setObjectType(GitStore.ChunkInfo.ObjectType.valueOf(objectType));
ChunkKey key = ChunkKey.create(repo, ObjectId.fromRaw(md.digest())); GitStore.ChunkInfo.Builder info = GitStore.ChunkInfo.newBuilder(); info.setSource(source); info.setObjectType(GitStore.ChunkInfo.ObjectType.valueOf(objectType));
result = result && (hasSource() == other.hasSource()); if (hasSource()) { result = result && (getSource() == other.getSource()); result = result && (hasObjectType() == other.hasObjectType()); if (hasObjectType()) { result = result && (getObjectType() == other.getObjectType()); result = result && (hasIsFragment() == other.hasIsFragment()); if (hasIsFragment()) { result = result && (getIsFragment() == other.getIsFragment()); result = result && (hasCachedPackKey() == other.hasCachedPackKey()); if (hasCachedPackKey()) { result = result && getCachedPackKey() .equals(other.getCachedPackKey()); result = result && (hasObjectCounts() == other.hasObjectCounts()); if (hasObjectCounts()) { result = result && getObjectCounts() .equals(other.getObjectCounts()); result = result && (hasChunkSize() == other.hasChunkSize()); if (hasChunkSize()) { result = result && (getChunkSize() == other.getChunkSize());
result = result && (hasSource() == other.hasSource()); if (hasSource()) { result = result && (getSource() == other.getSource()); result = result && (hasObjectType() == other.hasObjectType()); if (hasObjectType()) { result = result && (getObjectType() == other.getObjectType()); result = result && (hasIsFragment() == other.hasIsFragment()); if (hasIsFragment()) { result = result && (getIsFragment() == other.getIsFragment()); result = result && (hasCachedPackKey() == other.hasCachedPackKey()); if (hasCachedPackKey()) { result = result && getCachedPackKey() .equals(other.getCachedPackKey()); result = result && (hasObjectCounts() == other.hasObjectCounts()); if (hasObjectCounts()) { result = result && getObjectCounts() .equals(other.getObjectCounts()); result = result && (hasChunkSize() == other.hasChunkSize()); if (hasChunkSize()) { result = result && (getChunkSize() == other.getChunkSize());
.computeBytesSize(4, getCachedPackKeyBytes()); .computeInt32Size(8, metaSize_); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size;
ChunkInfo oldInfo = infoByKey.get(key); GitStore.ChunkInfo.Builder info = GitStore.ChunkInfo.newBuilder(oldInfo.getData());
@java.lang.Override public int hashCode() { int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasSource()) { hash = (37 * hash) + SOURCE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getSource()); if (hasObjectType()) { hash = (37 * hash) + OBJECT_TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getObjectType()); if (hasIsFragment()) { hash = (37 * hash) + IS_FRAGMENT_FIELD_NUMBER; hash = (53 * hash) + hashBoolean(getIsFragment()); if (hasCachedPackKey()) { hash = (37 * hash) + CACHED_PACK_KEY_FIELD_NUMBER; hash = (53 * hash) + getCachedPackKey().hashCode(); if (hasObjectCounts()) { hash = (37 * hash) + OBJECT_COUNTS_FIELD_NUMBER; hash = (53 * hash) + getObjectCounts().hashCode(); if (hasChunkSize()) { hash = (37 * hash) + CHUNK_SIZE_FIELD_NUMBER; hash = (53 * hash) + getChunkSize(); if (hasIndexSize()) { hash = (37 * hash) + INDEX_SIZE_FIELD_NUMBER;
ChunkInfo oldInfo = infoByKey.get(key); GitStore.ChunkInfo.Builder b = GitStore.ChunkInfo.newBuilder(oldInfo.getData()); b.setCachedPackKey(cachedPackKey.asString()); ChunkInfo newInfo = new ChunkInfo(key, b.build()); if (newInfo.getData().getIsFragment()) db.repository().put(repo, newInfo, dbWriteBuffer);
ChunkInfo oldInfo = infoByKey.get(key); GitStore.ChunkInfo.Builder b = GitStore.ChunkInfo.newBuilder(oldInfo.getData()); b.setCachedPackKey(cachedPackKey.asString()); ChunkInfo newInfo = new ChunkInfo(key, b.build()); if (newInfo.getData().getIsFragment()) db.repository().put(repo, newInfo, dbWriteBuffer);
public org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo buildPartial() { org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo result = new org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
@java.lang.Override public int hashCode() { int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasSource()) { hash = (37 * hash) + SOURCE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getSource()); if (hasObjectType()) { hash = (37 * hash) + OBJECT_TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getObjectType()); if (hasIsFragment()) { hash = (37 * hash) + IS_FRAGMENT_FIELD_NUMBER; hash = (53 * hash) + hashBoolean(getIsFragment()); if (hasCachedPackKey()) { hash = (37 * hash) + CACHED_PACK_KEY_FIELD_NUMBER; hash = (53 * hash) + getCachedPackKey().hashCode(); if (hasObjectCounts()) { hash = (37 * hash) + OBJECT_COUNTS_FIELD_NUMBER; hash = (53 * hash) + getObjectCounts().hashCode(); if (hasChunkSize()) { hash = (37 * hash) + CHUNK_SIZE_FIELD_NUMBER; hash = (53 * hash) + getChunkSize(); if (hasIndexSize()) { hash = (37 * hash) + INDEX_SIZE_FIELD_NUMBER;
.computeBytesSize(4, getCachedPackKeyBytes()); .computeInt32Size(8, metaSize_); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size;
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeEnum(1, source_.getNumber()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeEnum(2, objectType_.getNumber()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBool(3, isFragment_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getCachedPackKeyBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeMessage(5, objectCounts_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, chunkSize_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeInt32(7, indexSize_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeInt32(8, metaSize_); } getUnknownFields().writeTo(output); }
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); }
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; }