Class PackWriterBitmapPreparer
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.pack.PackWriterBitmapPreparer
-
class PackWriterBitmapPreparer extends java.lang.Object
Helper class for thePackWriter
to select commits for which to build pack index bitmaps.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PackWriterBitmapPreparer.CommitSelectionHelper
Container for state used in the first phase of selecting commits, which walks all of the reachable commits via the branch tips that are not covered by a previous pack's bitmaps (newWants
) and stores them innewCommitsByOldest
.private static class
PackWriterBitmapPreparer.NotInBitmapFilter
A RevFilter that excludes the commits named in a bitmap from the walk.
-
Field Summary
Fields Modifier and Type Field Description private BitmapIndexImpl
bitmapIndex
private PackBitmapIndexRemapper
bitmapRemapper
private BitmapIndexImpl
commitBitmapIndex
private int
contiguousCommitCount
private static int
DAY_IN_SECONDS
private static int
DISTANCE_THRESHOLD
private int
distantCommitSpan
private int
excessiveBranchCount
private long
inactiveBranchTimestamp
private static java.util.Comparator<RevCommit>
ORDER_BY_REVERSE_TIMESTAMP
private ProgressMonitor
pm
private ObjectReader
reader
private int
recentCommitCount
private int
recentCommitSpan
private java.util.Set<? extends ObjectId>
want
private PackBitmapIndexBuilder
writeBitmaps
-
Constructor Summary
Constructors Constructor Description PackWriterBitmapPreparer(ObjectReader reader, PackBitmapIndexBuilder writeBitmaps, ProgressMonitor pm, java.util.Set<? extends ObjectId> want, PackConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private PackWriterBitmapPreparer.CommitSelectionHelper
captureOldAndNewCommits(RevWalk rw, int expectedCommitCount, java.util.Set<? extends ObjectId> excludeFromBitmapSelection)
Records which of thewants
can be found in the previous GC pack's bitmap indices and which are new.private boolean
isRecentCommit(RevCommit revCommit)
(package private) BitmapWalker
newBitmapWalker()
(package private) int
nextSpan(int distanceFromTip)
(package private) java.util.Collection<BitmapCommit>
selectCommits(int expectedCommitCount, java.util.Set<? extends ObjectId> excludeFromBitmapSelection)
Returns the commit objects for which bitmap indices should be built.
-
-
-
Field Detail
-
DAY_IN_SECONDS
private static final int DAY_IN_SECONDS
- See Also:
- Constant Field Values
-
DISTANCE_THRESHOLD
private static final int DISTANCE_THRESHOLD
- See Also:
- Constant Field Values
-
ORDER_BY_REVERSE_TIMESTAMP
private static final java.util.Comparator<RevCommit> ORDER_BY_REVERSE_TIMESTAMP
-
reader
private final ObjectReader reader
-
pm
private final ProgressMonitor pm
-
want
private final java.util.Set<? extends ObjectId> want
-
writeBitmaps
private final PackBitmapIndexBuilder writeBitmaps
-
commitBitmapIndex
private final BitmapIndexImpl commitBitmapIndex
-
bitmapRemapper
private final PackBitmapIndexRemapper bitmapRemapper
-
bitmapIndex
private final BitmapIndexImpl bitmapIndex
-
contiguousCommitCount
private final int contiguousCommitCount
-
recentCommitCount
private final int recentCommitCount
-
recentCommitSpan
private final int recentCommitSpan
-
distantCommitSpan
private final int distantCommitSpan
-
excessiveBranchCount
private final int excessiveBranchCount
-
inactiveBranchTimestamp
private final long inactiveBranchTimestamp
-
-
Constructor Detail
-
PackWriterBitmapPreparer
PackWriterBitmapPreparer(ObjectReader reader, PackBitmapIndexBuilder writeBitmaps, ProgressMonitor pm, java.util.Set<? extends ObjectId> want, PackConfig config) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
selectCommits
java.util.Collection<BitmapCommit> selectCommits(int expectedCommitCount, java.util.Set<? extends ObjectId> excludeFromBitmapSelection) throws IncorrectObjectTypeException, java.io.IOException, MissingObjectException
Returns the commit objects for which bitmap indices should be built.- Parameters:
expectedCommitCount
- count of commits in the packexcludeFromBitmapSelection
- commits that should be excluded from bitmap selection- Returns:
- commit objects for which bitmap indices should be built
- Throws:
IncorrectObjectTypeException
- if any of the processed objects is not a commitjava.io.IOException
- on errors reading pack or index filesMissingObjectException
- if an expected object is missing
-
isRecentCommit
private boolean isRecentCommit(RevCommit revCommit)
-
captureOldAndNewCommits
private PackWriterBitmapPreparer.CommitSelectionHelper captureOldAndNewCommits(RevWalk rw, int expectedCommitCount, java.util.Set<? extends ObjectId> excludeFromBitmapSelection) throws IncorrectObjectTypeException, java.io.IOException, MissingObjectException
Records which of thewants
can be found in the previous GC pack's bitmap indices and which are new.- Parameters:
rw
- aRevWalk
to find reachable objects in this repositoryexpectedCommitCount
- expected count of commits. The actual count may be less due to unreachable garbage.excludeFromBitmapSelection
- commits that should be excluded from bitmap selection- Returns:
- a
PackWriterBitmapPreparer.CommitSelectionHelper
capturing which commits are covered by a previous pack's bitmaps and which new commits need bitmap coverage - Throws:
IncorrectObjectTypeException
- if any of the processed objects is not a commitjava.io.IOException
- on errors reading pack or index filesMissingObjectException
- if an expected object is missing
-
nextSpan
int nextSpan(int distanceFromTip)
-
newBitmapWalker
BitmapWalker newBitmapWalker()
-
-