Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.pack

pack-priv Class PackWriterBitmapPreparer

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.file.PackBitmapIndex.FLAG_REUSE, org.eclipse.jgit.revwalk.RevFlag.SEEN

Helper class for the PackWriter to select commits for which to build pack index bitmaps.

Nested and Inner Type Summary

Modifier and TypeClass and 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 in newCommitsByOldest.

private static class
PackWriterBitmapPreparer.NotInBitmapFilter

A RevFilter that excludes the commits named in a bitmap from the walk.

Field Summary

Modifier and TypeField and Description
private final BitmapIndexImpl
private final PackBitmapIndexRemapper
private final BitmapIndexImpl
private final int
private static final int
private static final int
private final int
private final int
private final int
private final long
private static final Comparator<RevCommit>
private final ProgressMonitor
private final ObjectReader
private final int
private final int
private final Set<? extends ObjectId>
private final PackBitmapIndexBuilder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private PackWriterBitmapPreparer.CommitSelectionHelper

Returns:

a CommitSelectionHelper capturing which commits are covered by a previous pack's bitmaps and which new commits need bitmap coverage
captureOldAndNewCommits
(RevWalk
a RevWalk to find reachable objects in this repository
rw
,
int
expected count of commits. The actual count may be less due to unreachable garbage.
expectedCommitCount
,
Set<? extends ObjectId>
commits that should be excluded from bitmap selection
excludeFromBitmapSelection
)

Records which of the wants can be found in the previous GC pack's bitmap indices and which are new.

private boolean
pack-priv BitmapWalker
pack-priv int
nextSpan(int distanceFromTip)

pack-priv Collection<BitmapCommit>

Returns:

commit objects for which bitmap indices should be built
selectCommits
(int
count of commits in the pack
expectedCommitCount
,
Set<? extends ObjectId>
commits that should be excluded from bitmap selection
excludeFromBitmapSelection
)

Returns the commit objects for which bitmap indices should be built.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitmapIndexback to summary
private final BitmapIndexImpl bitmapIndex
bitmapRemapperback to summary
private final PackBitmapIndexRemapper bitmapRemapper
commitBitmapIndexback to summary
private final BitmapIndexImpl commitBitmapIndex
contiguousCommitCountback to summary
private final int contiguousCommitCount
DAY_IN_SECONDSback to summary
private static final int DAY_IN_SECONDS
DISTANCE_THRESHOLDback to summary
private static final int DISTANCE_THRESHOLD
distantCommitSpanback to summary
private final int distantCommitSpan
excessiveBranchCountback to summary
private final int excessiveBranchCount
excessiveBranchTipCountback to summary
private final int excessiveBranchTipCount
inactiveBranchTimestampback to summary
private final long inactiveBranchTimestamp
ORDER_BY_REVERSE_TIMESTAMPback to summary
private static final Comparator<RevCommit> ORDER_BY_REVERSE_TIMESTAMP
pmback to summary
private final ProgressMonitor pm
readerback to summary
private final ObjectReader reader
recentCommitCountback to summary
private final int recentCommitCount
recentCommitSpanback to summary
private final int recentCommitSpan
wantback to summary
private final Set<? extends ObjectId> want
writeBitmapsback to summary
private final PackBitmapIndexBuilder writeBitmaps

Constructor Detail

PackWriterBitmapPreparerback to summary
pack-priv PackWriterBitmapPreparer(ObjectReader reader, PackBitmapIndexBuilder writeBitmaps, ProgressMonitor pm, Set<? extends ObjectId> want, PackConfig config) throws IOException

Method Detail

captureOldAndNewCommitsback to summary
private PackWriterBitmapPreparer.CommitSelectionHelper captureOldAndNewCommits(RevWalk rw, int expectedCommitCount, Set<? extends ObjectId> excludeFromBitmapSelection) throws IncorrectObjectTypeException, IOException, MissingObjectException

Records which of the wants can be found in the previous GC pack's bitmap indices and which are new.

Parameters
rw:RevWalk

a RevWalk to find reachable objects in this repository

expectedCommitCount:int

expected count of commits. The actual count may be less due to unreachable garbage.

excludeFromBitmapSelection:Set<? extends ObjectId>

commits that should be excluded from bitmap selection

Returns:PackWriterBitmapPreparer.CommitSelectionHelper

a CommitSelectionHelper capturing which commits are covered by a previous pack's bitmaps and which new commits need bitmap coverage

Exceptions
IncorrectObjectTypeException:
if any of the processed objects is not a commit
IOException:
on errors reading pack or index files
MissingObjectException:
if an expected object is missing
isRecentCommitback to summary
private boolean isRecentCommit(RevCommit revCommit)
newBitmapWalkerback to summary
pack-priv BitmapWalker newBitmapWalker()
nextSpanback to summary
pack-priv int nextSpan(int distanceFromTip)
selectCommitsback to summary
pack-priv Collection<BitmapCommit> selectCommits(int expectedCommitCount, Set<? extends ObjectId> excludeFromBitmapSelection) throws IncorrectObjectTypeException, IOException, MissingObjectException

Returns the commit objects for which bitmap indices should be built.

Parameters
expectedCommitCount:int

count of commits in the pack

excludeFromBitmapSelection:Set<? extends ObjectId>

commits that should be excluded from bitmap selection

Returns:Collection<BitmapCommit>

commit objects for which bitmap indices should be built

Exceptions
IncorrectObjectTypeException:
if any of the processed objects is not a commit
IOException:
on errors reading pack or index files
MissingObjectException:
if an expected object is missing
org.eclipse.jgit.internal.storage.pack back to summary

private final Class PackWriterBitmapPreparer.CommitSelectionHelper

extends Object
implements Iterable<RevCommit>
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.pack.PackWriterBitmapPreparer.CommitSelectionHelper
All Implemented Interfaces
java.lang.Iterable

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 in newCommitsByOldest. newCommitsByOldest is initialized with an expected size of all commits, but may be smaller if some commits are unreachable and/or some commits are covered by a previous pack's bitmaps. commitStartPos will contain a positive offset to either the root commit or the oldest commit not covered by previous bitmaps.

Field Summary

Modifier and TypeField and Description
pack-priv final RevCommit[]
pack-priv final int
pack-priv final Set<? extends ObjectId>
pack-priv final List<RevCommit>
pack-priv final List<BitmapCommit>
pack-priv final BitmapIndex.BitmapBuilder

Constructor Summary

AccessConstructor and Description
pack-priv
CommitSelectionHelper(Set<? extends ObjectId> newWants, RevCommit[] commitsByOldest, int commitStartPos, List<RevCommit> newWantsByNewest, BitmapIndex.BitmapBuilder reusedCommitsBitmap, List<BitmapCommit> reuse)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
public Iterator<RevCommit>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

newCommitsByOldestback to summary
pack-priv final RevCommit[] newCommitsByOldest
newCommitStartPosback to summary
pack-priv final int newCommitStartPos
newWantsback to summary
pack-priv final Set<? extends ObjectId> newWants
newWantsByNewestback to summary
pack-priv final List<RevCommit> newWantsByNewest
reusedCommitsback to summary
pack-priv final List<BitmapCommit> reusedCommits
reusedCommitsBitmapback to summary
pack-priv final BitmapIndex.BitmapBuilder reusedCommitsBitmap

Constructor Detail

CommitSelectionHelperback to summary
pack-priv CommitSelectionHelper(Set<? extends ObjectId> newWants, RevCommit[] commitsByOldest, int commitStartPos, List<RevCommit> newWantsByNewest, BitmapIndex.BitmapBuilder reusedCommitsBitmap, List<BitmapCommit> reuse)

Method Detail

getCommitCountback to summary
pack-priv int getCommitCount()
iteratorback to summary
public Iterator<RevCommit> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<RevCommit>

an Iterator.

Annotations
@Override
org.eclipse.jgit.internal.storage.pack back to summary

private Class PackWriterBitmapPreparer.NotInBitmapFilter

extends RevFilter
Class Inheritance

A RevFilter that excludes the commits named in a bitmap from the walk.

If a commit is in bitmap then that commit is not emitted by the walk and its parents are marked as SEEN so the walk can skip them. The bitmaps passed in have the property that the parents of any commit in bitmap are also in bitmap, so marking the parents as SEEN speeds up the RevWalk by saving it from walking down blind alleys and does not change the commits emitted.

Field Summary

Modifier and TypeField and Description
private final BitmapIndex.BitmapBuilder
Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
ALLMERGE_BASENO_MERGESNONEONLY_MERGES

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final PackWriterBitmapPreparer.NotInBitmapFilter
clone()

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Creates and returns a copy of this object.

public final boolean
include(RevWalk
the active walker this filter is being invoked from within.
rw
,
RevCommit
the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().
c
)

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

public final boolean
requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
negatetoString

Field Detail

bitmapback to summary
private final BitmapIndex.BitmapBuilder bitmap

Constructor Detail

NotInBitmapFilterback to summary
pack-priv NotInBitmapFilter(BitmapIndex.BitmapBuilder bitmap)

Method Detail

cloneback to summary
public final PackWriterBitmapPreparer.NotInBitmapFilter clone()

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Clone this revision filter, including its parameters.

This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.

Returns:PackWriterBitmapPreparer.NotInBitmapFilter

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
includeback to summary
public final boolean include(RevWalk rw, RevCommit c)

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

Parameters
rw:RevWalk

the active walker this filter is being invoked from within.

c:RevCommit

the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().

Returns:boolean

true to include this commit in the results; false to have this commit be omitted entirely from the results.

Annotations
@Override
requiresCommitBodyback to summary
public final boolean requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

Returns:boolean

true if the filter needs the commit body to be parsed.

Annotations
@Override