java.lang.Object
org.eclipse.jgit.internal.storage.midx.PackIndexMerger
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder collecting the inputs for the merger. -
Method Summary
Modifier and TypeMethodDescriptionstatic PackIndexMerger.Builderbuilder()Create a builderIterator over the merged indexes in sha1 order without duplicatesintObject count of the merged index (i.e. without duplicates)
-
Method Details
-
builder
Create a builder- Returns:
- an empty builder
-
getUniqueObjectCount
public int getUniqueObjectCount()Object count of the merged index (i.e. without duplicates)- Returns:
- object count of the merged index
-
bySha1Iterator
Iterator over the merged indexes in sha1 order without duplicatesThis always returns the same iterator resetted. We don't support two iterators over this merged data.
The returned entry in the iterator is mutable, callers should NOT keep a reference to it.
- Returns:
- an iterator in sha1 order without duplicates.
-