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

public Interface PackBitmapIndex

Known Direct Implementers
org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper, org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex
Imports
java.io.File, .IOException, .InputStream, java.text.MessageFormat, java.util.function.Supplier, org.eclipse.jgit.errors.CorruptObjectException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.AnyObjectId, .ObjectId, org.eclipse.jgit.util.io.SilentFileInputStream, com.googlecode.javaewah.EWAHCompressedBitmap

Logical representation of the bitmap data stored in the pack index. org.eclipse.jgit.lib.ObjectIds are encoded as a single integer in the range [0, getObjectCount()). Compressed bitmaps are available at certain ObjectIds, which represent all of the objects reachable from that ObjectId (include the ObjectId itself). The meaning of the positions in the bitmaps can be decoded using getObject(int) and ofObjectType(EWAHCompressedBitmap, int). Furthermore, findPosition(AnyObjectId) can be used to build other bitmaps that a compatible with the encoded bitmaps available from the index.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PackBitmapIndex.SupplierWithIOException<
the return type which is expected from get()
T
>

Supplier that propagates IOException.

Field Summary

Modifier and TypeField and Description
public static final int
FLAG_REUSE

Flag bit denoting the bitmap should be reused during index creation.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the bitmap id or -1 if the object was not found.
findPosition
(AnyObjectId
the id for which the bitmap position will be found.
objectId
)

Finds the position in the bitmap of the object.

public int

Returns:

the number of bitmaps in this bitmap index ready to use.
getBaseBitmapCount
()

Returns the number of bitmaps in this bitmap index ready to use, not XOR'ed against other entries.

public long

Returns:

Current size (in bytes) of all base bitmaps in this index.
getBaseBitmapSizeInBytes
()

Current size in bytes of all base bitmaps in the index.

public EWAHCompressedBitmap

Returns:

the bitmap or null if the object was not found.
getBitmap
(AnyObjectId
the id for which the bitmap will be found.
objectId
)

Returns the previously constructed bitmap for the object.

public int

Returns:

the number of bitmaps in this bitmap index.
getBitmapCount
()

Returns the number of bitmaps in this bitmap index.

public ObjectId

Returns:

the 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
)

Get the object at the bitmap position.

public int

Returns:

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

Obtain the total number of objects described by this index.

public default byte[]

Returns:

checksum as a byte array
getPackChecksum
()

Footer checksum applied on the bottom of the pack file.

public int

Returns:

the number of bitmaps in this bitmap index represented as XOR masks.
getXorBitmapCount
()

Returns the number of bitmaps in this bitmap index XOR'ed against other entries.

public long

Returns:

Current size (in bytes) of all xor bitmaps in this index.
getXorBitmapSizeInBytes
()

Current size in bytes of all XOR'ed bitmaps in the index.

public EWAHCompressedBitmap

Returns:

the object bitmap with only objects of the Git type.
ofObjectType
(EWAHCompressedBitmap
the object bitmap.
bitmap
,
int
the Git type.
type
)

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

public static PackBitmapIndex

Returns:

a copy of the index in-memory.
open
(File
existing pack .bitmap to read.
idxFile
,
PackIndex
the pack index for the corresponding pack file.
packIndex
,
PackReverseIndex
the pack reverse index for the corresponding pack file.
reverseIndex
)

Read an existing pack bitmap index file from a buffered stream.

public static PackBitmapIndex

Returns:

a copy of the index in-memory.
read
(InputStream
stream to read the bitmap index file from. The stream must be buffered as some small IOs are performed against the stream. The caller is responsible for closing the stream.
fd
,
PackIndex
the pack index for the corresponding pack file.
packIndex
,
PackReverseIndex
the pack reverse index for the corresponding pack file.
reverseIndex
)

Read an existing pack bitmap index file from a buffered stream.

public static PackBitmapIndex

Returns:

a copy of the index in-memory.
read
(InputStream
stream to read the bitmap index file from. The stream must be buffered as some small IOs are performed against the stream. The caller is responsible for closing the stream.
fd
,
PackBitmapIndex.SupplierWithIOException<PackIndex>
the supplier for pack index for the corresponding pack file.
packIndexSupplier
,
PackBitmapIndex.SupplierWithIOException<PackReverseIndex>
the supplier for pack reverse index for the corresponding pack file.
reverseIndexSupplier
,
boolean
whether reverse index should be loaded in parallel
loadParallelRevIndex
)

Read an existing pack bitmap index file from a buffered stream.

Field Detail

FLAG_REUSEback to summary
public static final int FLAG_REUSE

Flag bit denoting the bitmap should be reused during index creation.

Method Detail

findPositionback to summary
public int findPosition(AnyObjectId objectId)

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.

getBaseBitmapCountback to summary
public int getBaseBitmapCount()

Returns the number of bitmaps in this bitmap index ready to use, not XOR'ed against other entries.

Returns:int

the number of bitmaps in this bitmap index ready to use.

getBaseBitmapSizeInBytesback to summary
public long getBaseBitmapSizeInBytes()

Current size in bytes of all base bitmaps in the index. Resolving xors for bitmaps can affect this size.

Returns:long

Current size (in bytes) of all base bitmaps in this index.

getBitmapback to summary
public EWAHCompressedBitmap getBitmap(AnyObjectId objectId)

Returns the previously constructed bitmap for the object.

Parameters
objectId:AnyObjectId

the id for which the bitmap will be found.

Returns:EWAHCompressedBitmap

the bitmap or null if the object was not found.

getBitmapCountback to summary
public int getBitmapCount()

Returns the number of bitmaps in this bitmap index.

Returns:int

the number of bitmaps in this bitmap index.

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

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.

Exceptions
IllegalArgumentException:
when the item is not found.
getObjectCountback to summary
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.

Returns:int

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

getPackChecksumback to summary
public default byte[] getPackChecksum()

Footer checksum applied on the bottom of the pack file.

Returns:byte[]

checksum as a byte array

getXorBitmapCountback to summary
public int getXorBitmapCount()

Returns the number of bitmaps in this bitmap index XOR'ed against other entries.

Returns:int

the number of bitmaps in this bitmap index represented as XOR masks.

getXorBitmapSizeInBytesback to summary
public long getXorBitmapSizeInBytes()

Current size in bytes of all XOR'ed bitmaps in the index. Resolving xors for bitmaps can affect this size.

Returns:long

Current size (in bytes) of all xor bitmaps in this index.

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

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.

openback to summary
public static PackBitmapIndex open(File idxFile, PackIndex packIndex, PackReverseIndex reverseIndex) throws IOException

Read an existing pack bitmap index file from a buffered stream.

The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

Parameters
idxFile:File

existing pack .bitmap to read.

packIndex:PackIndex

the pack index for the corresponding pack file.

reverseIndex:PackReverseIndex

the pack reverse index for the corresponding pack file.

Returns:PackBitmapIndex

a copy of the index in-memory.

Exceptions
IOException:
the stream cannot be read.
CorruptObjectException:
the stream does not contain a valid pack bitmap index.
readback to summary
public static PackBitmapIndex read(InputStream fd, PackIndex packIndex, PackReverseIndex reverseIndex) throws IOException

Read an existing pack bitmap index file from a buffered stream.

The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

Parameters
fd:InputStream

stream to read the bitmap index file from. The stream must be buffered as some small IOs are performed against the stream. The caller is responsible for closing the stream.

packIndex:PackIndex

the pack index for the corresponding pack file.

reverseIndex:PackReverseIndex

the pack reverse index for the corresponding pack file.

Returns:PackBitmapIndex

a copy of the index in-memory.

Exceptions
IOException:
the stream cannot be read.
CorruptObjectException:
the stream does not contain a valid pack bitmap index.
readback to summary
public static PackBitmapIndex read(InputStream fd, PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier, PackBitmapIndex.SupplierWithIOException<PackReverseIndex> reverseIndexSupplier, boolean loadParallelRevIndex) throws IOException

Read an existing pack bitmap index file from a buffered stream.

The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

Parameters
fd:InputStream

stream to read the bitmap index file from. The stream must be buffered as some small IOs are performed against the stream. The caller is responsible for closing the stream.

packIndexSupplier:PackBitmapIndex.SupplierWithIOException<PackIndex>

the supplier for pack index for the corresponding pack file.

reverseIndexSupplier:PackBitmapIndex.SupplierWithIOException<PackReverseIndex>

the supplier for pack reverse index for the corresponding pack file.

loadParallelRevIndex:boolean

whether reverse index should be loaded in parallel

Returns:PackBitmapIndex

a copy of the index in-memory.

Exceptions
IOException:
the stream cannot be read.
CorruptObjectException:
the stream does not contain a valid pack bitmap index.
org.eclipse.jgit.internal.storage.file back to summary

public Interface PackBitmapIndex.SupplierWithIOException<T>

Annotations
@FunctionalInterface
Type Parameters
<T>
the return type which is expected from get()

Supplier that propagates IOException.

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

result
get
()

Get result.

Method Detail

getback to summary
public T get() throws IOException

Get result.

Returns:T

result

Exceptions
IOException:
if an IO error occurred
See Also
Supplier#get()