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

public Interface PackReverseIndex

Known Direct Implementers
org.eclipse.jgit.internal.storage.file.PackReverseIndexComputed, org.eclipse.jgit.internal.storage.file.PackReverseIndexV1
Imports
org.eclipse.jgit.errors.CorruptObjectException, .PackMismatchException, org.eclipse.jgit.lib.ObjectId

Reverse index for forward pack index. Provides operations based on offset instead of object id. Such offset-based reverse lookups are performed in O(log n) time.

See Also
PackIndex, Pack

Field Summary

Modifier and TypeField and Description
public static final byte[]
MAGIC

Magic bytes that uniquely identify git reverse index files.

public static final int
VERSION_1

The first reverse index file version.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

offset of the next object in a pack or maxOffset if provided offset was the last one.
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
)

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

public ObjectId

Returns:

object id for this offset, or null if no object was found.
findObject
(long
start offset of object to find.
offset
)

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

public ObjectId

Returns:

the object in that position
findObjectByPosition
(int
the position of the object in the reverse index
nthPosition
)

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

public int

Returns:

the position in the reverse index of the object
findPosition
(long
the pack offset of the object
offset
)

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

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

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

Field Detail

MAGICback to summary
public static final byte[] MAGIC

Magic bytes that uniquely identify git reverse index files.

VERSION_1back to summary
public static final int VERSION_1

The first reverse index file version.

Method Detail

findNextOffsetback to summary
public long findNextOffset(long offset, long maxOffset) throws CorruptObjectException

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.

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

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.

findObjectByPositionback to summary
public ObjectId findObjectByPosition(int nthPosition)

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

Parameters
nthPosition:int

the position of the object in the reverse index

Returns:ObjectId

the object in that position

findPositionback to summary
public int findPosition(long offset)

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

verifyPackChecksumback to summary
public void verifyPackChecksum(String packFilePath) throws PackMismatchException

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

Exceptions
PackMismatchException:
if the checksums do not match