Class PackIndexMerger

java.lang.Object
org.eclipse.jgit.internal.storage.midx.PackIndexMerger

public class PackIndexMerger extends Object
Collect the stats and offers an iterator over the union of n-pack indexes.

The multipack index is a list of (sha1, packid, offset) ordered by sha1. We can build it from the individual pack indexes (sha1, offset) ordered by sha1, with a simple merge ignoring duplicates.

This class encapsulates the merging logic and precalculates the stats that the index needs (like total count of objects). To limit memory consumption, it does the merge as it goes during the iteration and iterators use mutable entries. The stats of the combined index are calculated in an iteration at construction time.

  • Method Details