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

public Class PackBitmapIndexBuilder

extends BasePackBitmapIndex
Class Inheritance
Imports
java.text.MessageFormat, java.util.ArrayDeque, .ArrayList, .Collections, .List, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.internal.storage.pack.BitmapCommit, .ObjectToPack, org.eclipse.jgit.lib.AnyObjectId, .BitmapIndex.Bitmap, .Constants, .ObjectId, .ObjectIdOwnerMap, org.eclipse.jgit.util.BlockList, com.googlecode.javaewah.EWAHCompressedBitmap

Helper for constructing org.eclipse.jgit.internal.storage.file.PackBitmapIndexes.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
PackBitmapIndexBuilder.StoredEntry

Data object for the on disk representation of a bitmap entry.

Field Summary

Modifier and TypeField and Description
private List<PackBitmapIndexBuilder.StoredEntry>
private final ArrayDeque<BasePackBitmapIndex.StoredBitmap>
private final EWAHCompressedBitmap
private final BlockList<PackBitmapIndexBuilder.PositionEntry>
private final EWAHCompressedBitmap
private static final int
pack-priv final ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry>
private final EWAHCompressedBitmap
private final EWAHCompressedBitmap

Constructor Summary

AccessConstructor and Description
public
PackBitmapIndexBuilder(List<ObjectToPack>
objects sorted by name. The list must be initially sorted by ObjectId (name); it will be resorted in place.
objects
)

Creates a PackBitmapIndex used for building the contents of an index file.

Method Summary

Modifier and TypeMethod and Description
public void
addBitmap(AnyObjectId
the object id key for the bitmap.
objectId
,
BitmapIndex.Bitmap
the bitmap
bitmap
,
int
the flags to be stored with the bitmap
flags
)

Stores the bitmap for the objectId.

public void
addBitmap(AnyObjectId
the object id key for the bitmap.
objectId
,
EWAHCompressedBitmap
the bitmap
bitmap
,
int
the flags to be stored with the bitmap
flags
)

Stores the bitmap for the objectId.

public int
findPosition(AnyObjectId
the id for which the bitmap position will be found.
objectId
)

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.findPosition.

Finds the position in the bitmap of the object.

private PackBitmapIndexBuilder.StoredEntry
public int
getBitmapCount()

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getBitmapCount.

Returns the number of bitmaps in this bitmap index.

public EWAHCompressedBitmap

Returns:

the blob object bitmap.
getBlobs
()

Get the blob object bitmap.

public EWAHCompressedBitmap

Returns:

the commit object bitmap.
getCommits
()

Get the commit object bitmap.

public List<PackBitmapIndexBuilder.StoredEntry>

Returns:

a list of the xor compressed entries.
getCompressedBitmaps
()

Get list of xor compressed entries that need to be written.

public ObjectId
getObject(int
the offset in the bitmap which corresponds to an object of interest. This position is the same as the order of the object in the PackFile.
position
)

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObject.

Get the object at the bitmap position.

public int
getObjectCount()

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObjectCount.

Obtain the total number of objects described by this index.

public ObjectIdOwnerMap<ObjectIdOwnerMap.Entry>

Returns:

set of objects included in the pack.
getObjectSet
()

Get set of objects included in the pack.

public int

Returns:

the index storage options.
getOptions
()

Get the index storage options.

public EWAHCompressedBitmap

Returns:

the tag object bitmap.
getTags
()

Get the tag object bitmap.

public EWAHCompressedBitmap

Returns:

the tree object bitmap.
getTrees
()

Get the tree object bitmap.

public EWAHCompressedBitmap
ofObjectType(EWAHCompressedBitmap
the object bitmap.
bitmap
,
int
the Git type.
type
)

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.ofObjectType.

Returns a bitmap containing positions for objects that have the given Git type.

public void
processBitmapForWrite(BitmapCommit
the commit corresponds to the bitmap.
c
,
BitmapIndex.Bitmap
the bitmap to be written.
bitmap
,
int
the flags of the commit.
flags
)

Processes a commit and prepares its bitmap to write to the bitmap index file.

public void
resetBitmaps(int
the expected number of bitmap entries to be written.
size
)

Remove all the bitmaps entries added.

private static void
Inherited from org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex:
getBaseBitmapCountgetBaseBitmapSizeInBytesgetBitmapgetBitmapsgetXorBitmapCountgetXorBitmapSizeInBytes

Field Detail

bitmapsToWriteback to summary
private List<PackBitmapIndexBuilder.StoredEntry> bitmapsToWrite
bitmapsToWriteXorBufferback to summary
private final ArrayDeque<BasePackBitmapIndex.StoredBitmap> bitmapsToWriteXorBuffer
blobsback to summary
private final EWAHCompressedBitmap blobs
byOffsetback to summary
private final BlockList<PackBitmapIndexBuilder.PositionEntry> byOffset
commitsback to summary
private final EWAHCompressedBitmap commits
positionEntriesback to summary
pack-priv final ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry> positionEntries
tagsback to summary
private final EWAHCompressedBitmap tags
treesback to summary
private final EWAHCompressedBitmap trees

Constructor Detail

PackBitmapIndexBuilderback to summary
public PackBitmapIndexBuilder(List<ObjectToPack> objects)

Creates a PackBitmapIndex used for building the contents of an index file.

Parameters
objects:List<ObjectToPack>

objects sorted by name. The list must be initially sorted by ObjectId (name); it will be resorted in place.

Method Detail

addBitmapback to summary
public void addBitmap(AnyObjectId objectId, BitmapIndex.Bitmap bitmap, int flags)

Stores the bitmap for the objectId.

Parameters
objectId:AnyObjectId

the object id key for the bitmap.

bitmap:BitmapIndex.Bitmap

the bitmap

flags:int

the flags to be stored with the bitmap

addBitmapback to summary
public void addBitmap(AnyObjectId objectId, EWAHCompressedBitmap bitmap, int flags)

Stores the bitmap for the objectId.

Parameters
objectId:AnyObjectId

the object id key for the bitmap.

bitmap:EWAHCompressedBitmap

the bitmap

flags:int

the flags to be stored with the bitmap

findPositionback to summary
public int findPosition(AnyObjectId objectId)

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.findPosition.

Doc from org.eclipse.jgit.internal.storage.file.PackBitmapIndex.findPosition.

Finds the position in the bitmap of the object.

Parameters
objectId:AnyObjectId

the id for which the bitmap position will be found.

Returns:int

the bitmap id or -1 if the object was not found.

Annotations
@Override
generateStoredEntryback to summary
private PackBitmapIndexBuilder.StoredEntry generateStoredEntry(BasePackBitmapIndex.StoredBitmap bitmapToWrite)
getBitmapCountback to summary
public int getBitmapCount()

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getBitmapCount.

Doc from org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getBitmapCount.

Returns the number of bitmaps in this bitmap index.

Returns:int

the number of bitmaps in this bitmap index.

Annotations
@Override
getBlobsback to summary
public EWAHCompressedBitmap getBlobs()

Get the blob object bitmap.

Returns:EWAHCompressedBitmap

the blob object bitmap.

getCommitsback to summary
public EWAHCompressedBitmap getCommits()

Get the commit object bitmap.

Returns:EWAHCompressedBitmap

the commit object bitmap.

getCompressedBitmapsback to summary
public List<PackBitmapIndexBuilder.StoredEntry> getCompressedBitmaps()

Get list of xor compressed entries that need to be written.

Returns:List<PackBitmapIndexBuilder.StoredEntry>

a list of the xor compressed entries.

getObjectback to summary
public ObjectId getObject(int position) throws IllegalArgumentException

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObject.

Doc from org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObject.

Get the object at the bitmap position.

Parameters
position:int

the offset in the bitmap which corresponds to an object of interest. This position is the same as the order of the object in the PackFile.

Returns:ObjectId

the ObjectId.

Annotations
@Override
Exceptions
IllegalArgumentException:
when the item is not found.
getObjectCountback to summary
public int getObjectCount()

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObjectCount.

Doc from org.eclipse.jgit.internal.storage.file.PackBitmapIndex.getObjectCount.

Obtain the total number of objects described by this index. getObjectCount() - 1 is the largest bit that will be set in a bitmap.

Returns:int

number of objects in this index, and likewise in the associated pack that this index was generated from.

Annotations
@Override
getObjectSetback to summary
public ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> getObjectSet()

Get set of objects included in the pack.

Returns:ObjectIdOwnerMap<ObjectIdOwnerMap.Entry>

set of objects included in the pack.

getOptionsback to summary
public int getOptions()

Get the index storage options.

Returns:int

the index storage options.

getTagsback to summary
public EWAHCompressedBitmap getTags()

Get the tag object bitmap.

Returns:EWAHCompressedBitmap

the tag object bitmap.

getTreesback to summary
public EWAHCompressedBitmap getTrees()

Get the tree object bitmap.

Returns:EWAHCompressedBitmap

the tree object bitmap.

ofObjectTypeback to summary
public EWAHCompressedBitmap ofObjectType(EWAHCompressedBitmap bitmap, int type)

Implements org.eclipse.jgit.internal.storage.file.PackBitmapIndex.ofObjectType.

Doc from org.eclipse.jgit.internal.storage.file.PackBitmapIndex.ofObjectType.

Returns a bitmap containing positions for objects that have the given Git type.

Parameters
bitmap:EWAHCompressedBitmap

the object bitmap.

type:int

the Git type.

Returns:EWAHCompressedBitmap

the object bitmap with only objects of the Git type.

Annotations
@Override
processBitmapForWriteback to summary
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:BitmapCommit

the commit corresponds to the bitmap.

bitmap:BitmapIndex.Bitmap

the bitmap to be written.

flags:int

the flags of the commit.

resetBitmapsback to summary
public void resetBitmaps(int size)

Remove all the bitmaps entries added.

Parameters
size:int

the expected number of bitmap entries to be written.

sortByOffsetAndIndexback to summary
private static void sortByOffsetAndIndex(BlockList<PackBitmapIndexBuilder.PositionEntry> byOffset, ObjectIdOwnerMap<PackBitmapIndexBuilder.PositionEntry> positionEntries, List<ObjectToPack> entries)
org.eclipse.jgit.internal.storage.file back to summary

private final Class PackBitmapIndexBuilder.PositionEntry

extends Entry
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv
PositionEntry(AnyObjectId objectId, int idxPosition)

Field Detail

idxPositionback to summary
pack-priv final int idxPosition
ridxPositionback to summary
pack-priv int ridxPosition

Constructor Detail

PositionEntryback to summary
pack-priv PositionEntry(AnyObjectId objectId, int idxPosition)
org.eclipse.jgit.internal.storage.file back to summary

public final Class PackBitmapIndexBuilder.StoredEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder.StoredEntry

Data object for the on disk representation of a bitmap entry.

Field Summary

Modifier and TypeField and Description
private final EWAHCompressedBitmap
private final int
private final long
private final ObjectId
private final int

Constructor Summary

AccessConstructor and Description
public
StoredEntry(ObjectId
objectId of the object associated with the bitmap
objectId
,
long
position of this object into the pack index (i.e. sorted by sha1)
idxPosition
,
EWAHCompressedBitmap
bitmap associated with this object
bitmap
,
int
offset of the bitmap against which this bitmap is xor-compressed. If 0, then this bitmap is not xor-compressed against any other bitmap
xorOffset
,
int
flags for this bitmap
flags
)

Create a StoredEntry

Method Summary

Modifier and TypeMethod and Description
public EWAHCompressedBitmap

Returns:

the bitmap
getBitmap
()

Get the bitmap

public int

Returns:

the flags
getFlags
()

Get the flags

public long

Returns:

the position of the object with this bitmap in the primary index (i.e. ordered by sha1)
getIdxPosition
()

public ObjectId

Returns:

the objectId of the object associated with this bitmap
getObjectId
()

public int

Returns:

the xorOffset
getXorOffset
()

Get the xorOffset

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitmapback to summary
private final EWAHCompressedBitmap bitmap
flagsback to summary
private final int flags
idxPositionback to summary
private final long idxPosition
objectIdback to summary
private final ObjectId objectId
xorOffsetback to summary
private final int xorOffset

Constructor Detail

StoredEntryback to summary
public StoredEntry(ObjectId objectId, long idxPosition, EWAHCompressedBitmap bitmap, int xorOffset, int flags)

Create a StoredEntry

Parameters
objectId:ObjectId

objectId of the object associated with the bitmap

idxPosition:long

position of this object into the pack index (i.e. sorted by sha1)

bitmap:EWAHCompressedBitmap

bitmap associated with this object

xorOffset:int

offset of the bitmap against which this bitmap is xor-compressed. If 0, then this bitmap is not xor-compressed against any other bitmap

flags:int

flags for this bitmap

Method Detail

getBitmapback to summary
public EWAHCompressedBitmap getBitmap()

Get the bitmap

Returns:EWAHCompressedBitmap

the bitmap

getFlagsback to summary
public int getFlags()

Get the flags

Returns:int

the flags

getIdxPositionback to summary
public long getIdxPosition()
Returns:long

the position of the object with this bitmap in the primary index (i.e. ordered by sha1)

getObjectIdback to summary
public ObjectId getObjectId()
Returns:ObjectId

the objectId of the object associated with this bitmap

getXorOffsetback to summary
public int getXorOffset()

Get the xorOffset

Returns:int

the xorOffset