Class PackBitmapIndexBuilder
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndex
-
- org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder
-
public class PackBitmapIndexBuilder extends BasePackBitmapIndex
Helper for constructingPackBitmapIndex
es.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PackBitmapIndexBuilder.PositionEntry
static class
PackBitmapIndexBuilder.StoredEntry
Data object for the on disk representation of a bitmap entry.-
Nested classes/interfaces inherited from class org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex
BasePackBitmapIndex.StoredBitmap
-
Nested classes/interfaces inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
PackBitmapIndex.SupplierWithIOException<T>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PackBitmapIndexBuilder.StoredEntry>
bitmapsToWrite
private java.util.LinkedList<BasePackBitmapIndex.StoredBitmap>
bitmapsToWriteXorBuffer
private com.googlecode.javaewah.EWAHCompressedBitmap
blobs
private BlockList<PackBitmapIndexBuilder.PositionEntry>
byOffset
private com.googlecode.javaewah.EWAHCompressedBitmap
commits
private static int
MAX_XOR_OFFSET_SEARCH
(package private) ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry>
positionEntries
private com.googlecode.javaewah.EWAHCompressedBitmap
tags
private com.googlecode.javaewah.EWAHCompressedBitmap
trees
-
Fields inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
FLAG_REUSE, packChecksum
-
-
Constructor Summary
Constructors Constructor Description PackBitmapIndexBuilder(java.util.List<ObjectToPack> objects)
Creates a PackBitmapIndex used for building the contents of an index file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBitmap(AnyObjectId objectId, com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int flags)
Stores the bitmap for the objectId.void
addBitmap(AnyObjectId objectId, BitmapIndex.Bitmap bitmap, int flags)
Stores the bitmap for the objectId.int
findPosition(AnyObjectId objectId)
Finds the position in the bitmap of the object.private PackBitmapIndexBuilder.StoredEntry
generateStoredEntry(BasePackBitmapIndex.StoredBitmap bitmapToWrite)
int
getBitmapCount()
Returns the number of bitmaps in this bitmap index.com.googlecode.javaewah.EWAHCompressedBitmap
getBlobs()
Get the blob object bitmap.com.googlecode.javaewah.EWAHCompressedBitmap
getCommits()
Get the commit object bitmap.java.util.List<PackBitmapIndexBuilder.StoredEntry>
getCompressedBitmaps()
Get list of xor compressed entries that need to be written.ObjectId
getObject(int position)
Get the object at the bitmap position.int
getObjectCount()
Obtain the total number of objects described by this index.ObjectIdOwnerMap<ObjectIdOwnerMap.Entry>
getObjectSet()
Get set of objects included in the pack.int
getOptions()
Get the index storage options.com.googlecode.javaewah.EWAHCompressedBitmap
getTags()
Get the tag object bitmap.com.googlecode.javaewah.EWAHCompressedBitmap
getTrees()
Get the tree object bitmap.com.googlecode.javaewah.EWAHCompressedBitmap
ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
Returns a bitmap containing positions for objects that have the given Git type.void
processBitmapForWrite(BitmapCommit c, BitmapIndex.Bitmap bitmap, int flags)
Processes a commit and prepares its bitmap to write to the bitmap index file.void
resetBitmaps(int size)
Remove all the bitmaps entries added.private static void
sortByOffsetAndIndex(BlockList<PackBitmapIndexBuilder.PositionEntry> byOffset, ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry> positionEntries, java.util.List<ObjectToPack> entries)
-
Methods inherited from class org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex
getBitmap, getBitmaps
-
Methods inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
open, read, read
-
-
-
-
Field Detail
-
MAX_XOR_OFFSET_SEARCH
private static final int MAX_XOR_OFFSET_SEARCH
- See Also:
- Constant Field Values
-
commits
private final com.googlecode.javaewah.EWAHCompressedBitmap commits
-
trees
private final com.googlecode.javaewah.EWAHCompressedBitmap trees
-
blobs
private final com.googlecode.javaewah.EWAHCompressedBitmap blobs
-
tags
private final com.googlecode.javaewah.EWAHCompressedBitmap tags
-
byOffset
private final BlockList<PackBitmapIndexBuilder.PositionEntry> byOffset
-
bitmapsToWriteXorBuffer
private final java.util.LinkedList<BasePackBitmapIndex.StoredBitmap> bitmapsToWriteXorBuffer
-
bitmapsToWrite
private java.util.List<PackBitmapIndexBuilder.StoredEntry> bitmapsToWrite
-
positionEntries
final ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry> positionEntries
-
-
Constructor Detail
-
PackBitmapIndexBuilder
public PackBitmapIndexBuilder(java.util.List<ObjectToPack> objects)
Creates a PackBitmapIndex used for building the contents of an index file.- Parameters:
objects
- objects sorted by name. The list must be initially sorted by ObjectId (name); it will be resorted in place.
-
-
Method Detail
-
sortByOffsetAndIndex
private static void sortByOffsetAndIndex(BlockList<PackBitmapIndexBuilder.PositionEntry> byOffset, ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry> positionEntries, java.util.List<ObjectToPack> entries)
-
getObjectSet
public ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> getObjectSet()
Get set of objects included in the pack.- Returns:
- set of objects included in the pack.
-
addBitmap
public void addBitmap(AnyObjectId objectId, BitmapIndex.Bitmap bitmap, int flags)
Stores the bitmap for the objectId.- Parameters:
objectId
- the object id key for the bitmap.bitmap
- the bitmapflags
- the flags to be stored with the bitmap
-
processBitmapForWrite
public void processBitmapForWrite(BitmapCommit c, BitmapIndex.Bitmap bitmap, int flags)
Processes a commit and prepares its bitmap to write to the bitmap index file.- Parameters:
c
- the commit corresponds to the bitmap.bitmap
- the bitmap to be written.flags
- the flags of the commit.
-
generateStoredEntry
private PackBitmapIndexBuilder.StoredEntry generateStoredEntry(BasePackBitmapIndex.StoredBitmap bitmapToWrite)
-
addBitmap
public void addBitmap(AnyObjectId objectId, com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int flags)
Stores the bitmap for the objectId.- Parameters:
objectId
- the object id key for the bitmap.bitmap
- the bitmapflags
- the flags to be stored with the bitmap
-
ofObjectType
public com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
Returns a bitmap containing positions for objects that have the given Git type.- Specified by:
ofObjectType
in classPackBitmapIndex
- Parameters:
bitmap
- the object bitmap.type
- the Git type.- Returns:
- the object bitmap with only objects of the Git type.
-
findPosition
public int findPosition(AnyObjectId objectId)
Finds the position in the bitmap of the object.- Specified by:
findPosition
in classPackBitmapIndex
- Parameters:
objectId
- the id for which the bitmap position will be found.- Returns:
- the bitmap id or -1 if the object was not found.
-
getObject
public ObjectId getObject(int position) throws java.lang.IllegalArgumentException
Get the object at the bitmap position.- Specified by:
getObject
in classPackBitmapIndex
- Parameters:
position
- the id for which the object will be found.- Returns:
- the ObjectId.
- Throws:
java.lang.IllegalArgumentException
- when the item is not found.
-
getCommits
public com.googlecode.javaewah.EWAHCompressedBitmap getCommits()
Get the commit object bitmap.- Returns:
- the commit object bitmap.
-
getTrees
public com.googlecode.javaewah.EWAHCompressedBitmap getTrees()
Get the tree object bitmap.- Returns:
- the tree object bitmap.
-
getBlobs
public com.googlecode.javaewah.EWAHCompressedBitmap getBlobs()
Get the blob object bitmap.- Returns:
- the blob object bitmap.
-
getTags
public com.googlecode.javaewah.EWAHCompressedBitmap getTags()
Get the tag object bitmap.- Returns:
- the tag object bitmap.
-
getOptions
public int getOptions()
Get the index storage options.- Returns:
- the index storage options.
-
getBitmapCount
public int getBitmapCount()
Returns the number of bitmaps in this bitmap index.- Specified by:
getBitmapCount
in classPackBitmapIndex
- Returns:
- the number of bitmaps in this bitmap index.
-
resetBitmaps
public void resetBitmaps(int size)
Remove all the bitmaps entries added.- Parameters:
size
- the expected number of bitmap entries to be written.
-
getObjectCount
public int getObjectCount()
Obtain the total number of objects described by this index.getObjectCount() - 1
is the largest bit that will be set in a bitmap.- Specified by:
getObjectCount
in classPackBitmapIndex
- Returns:
- number of objects in this index, and likewise in the associated pack that this index was generated from.
-
getCompressedBitmaps
public java.util.List<PackBitmapIndexBuilder.StoredEntry> getCompressedBitmaps()
Get list of xor compressed entries that need to be written.- Returns:
- a list of the xor compressed entries.
-
-