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

pack-priv final Class PackReverseIndexV1

extends Object
implements PackReverseIndex
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.storage.file.PackReverseIndex
Static Imports
org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH

Reverse index for forward pack index which is parsed from a version 1 file.

The file format is specified at https://git-scm.com/docs/pack-format#_pack_rev_files_have_the_format.

Field Summary

Modifier and TypeField and Description
private final DataInput
private int[]
private final DigestInputStream
private int
pack-priv static final int
pack-priv static final int
private byte[]
private PackIndex
private final PackBitmapIndex.SupplierWithIOException<PackIndex>
packIndexSupplier

A lazy supplier for the corresponding PackIndex.

private static final int

Constructor Summary

AccessConstructor and Description
pack-priv
PackReverseIndexV1(DigestInputStream inputStream, long objectCount, PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier)

Method Summary

Modifier and TypeMethod and Description
private int
binarySearchByOffset(long wantedOffset)

private int
public long
findNextOffset(long
start offset of previous object (must be valid-existing offset).
offset
,
long
maximum offset in a pack (returned when there is no next offset).
maxOffset
)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findNextOffset.

Search for the next offset to the specified offset in this pack (reverse) index.

public ObjectId
findObject(long
start offset of object to find.
offset
)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObject.

Search for object id with the specified start offset in this pack (reverse) index.

public ObjectId
findObjectByPosition(int
the position of the object in the reverse index
position
)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObjectByPosition.

Find the object that is in the given position in the reverse index.

private long
public int
findPosition(long
the pack offset of the object
offset
)

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

Find the position in the reverse index of the object at the given pack offset.

private PackIndex
private void
private void
public void
verifyPackChecksum(String
the path to display in event of a mismatch
packFilePath
)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.verifyPackChecksum.

Verify that the pack checksum found in the reverse index matches that from the pack file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataInback to summary
private final DataInput dataIn
indexPositionsSortedByOffsetback to summary
private int[] indexPositionsSortedByOffset
inputStreamback to summary
private final DigestInputStream inputStream
objectCountback to summary
private int objectCount
OID_VERSION_SHA1back to summary
pack-priv static final int OID_VERSION_SHA1
OID_VERSION_SHA256back to summary
pack-priv static final int OID_VERSION_SHA256
packChecksumback to summary
private byte[] packChecksum
packIndexback to summary
private PackIndex packIndex
packIndexSupplierback to summary
private final PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier

A lazy supplier for the corresponding PackIndex. The PackIndex is not needed during instantiation and parsing, only later when querying the reverse index. Allow lazy loading so that the parsing of the forward and reverse indices could happen in parallel.

SHA1_BYTESback to summary
private static final int SHA1_BYTES

Constructor Detail

PackReverseIndexV1back to summary
pack-priv PackReverseIndexV1(DigestInputStream inputStream, long objectCount, PackBitmapIndex.SupplierWithIOException<PackIndex> packIndexSupplier) throws IOException

Method Detail

binarySearchByOffsetback to summary
private int binarySearchByOffset(long wantedOffset)
findForwardPositionByReversePositionback to summary
private int findForwardPositionByReversePosition(int reversePosition)
findNextOffsetback to summary
public long findNextOffset(long offset, long maxOffset) throws CorruptObjectException

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findNextOffset.

Doc from org.eclipse.jgit.internal.storage.file.PackReverseIndex.findNextOffset.

Search for the next offset to the specified offset in this pack (reverse) index.

Parameters
offset:long

start offset of previous object (must be valid-existing offset).

maxOffset:long

maximum offset in a pack (returned when there is no next offset).

Returns:long

offset of the next object in a pack or maxOffset if provided offset was the last one.

Annotations
@Override
Exceptions
CorruptObjectException:
when there is no object with the provided offset.
findObjectback to summary
public ObjectId findObject(long offset)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObject.

Doc from org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObject.

Search for object id with the specified start offset in this pack (reverse) index.

Parameters
offset:long

start offset of object to find.

Returns:ObjectId

object id for this offset, or null if no object was found.

Annotations
@Override
findObjectByPositionback to summary
public ObjectId findObjectByPosition(int position)

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObjectByPosition.

Doc from org.eclipse.jgit.internal.storage.file.PackReverseIndex.findObjectByPosition.

Find the object that is in the given position in the reverse index.

Parameters
position:int

the position of the object in the reverse index

Returns:ObjectId

the object in that position

Annotations
@Override
findOffsetByReversePositionback to summary
private long findOffsetByReversePosition(int position)
findPositionback to summary
public int findPosition(long offset)

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

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

Find the position in the reverse index of the object at the given pack offset.

Parameters
offset:long

the pack offset of the object

Returns:int

the position in the reverse index of the object

Annotations
@Override
getPackIndexback to summary
private PackIndex getPackIndex()
parseBodyback to summary
private void parseBody() throws IOException
parseChecksumsback to summary
private void parseChecksums() throws IOException
verifyPackChecksumback to summary
public void verifyPackChecksum(String packFilePath) throws PackMismatchException

Implements org.eclipse.jgit.internal.storage.file.PackReverseIndex.verifyPackChecksum.

Doc from org.eclipse.jgit.internal.storage.file.PackReverseIndex.verifyPackChecksum.

Verify that the pack checksum found in the reverse index matches that from the pack file.

Parameters
packFilePath:String

the path to display in event of a mismatch

Annotations
@Override
Exceptions
PackMismatchException:
if the checksums do not match