Creating an instance uses an insertion sort of the entries in the forward index, so it runs in quadratic time on average.
| Modifier and Type | Field and Description |
|---|---|
| private final long | bucketSize
The difference in offset between the start of an offset bucket and the start of its succeeding bucket. |
| private final PackIndex | index
Index we were created from, and that has our ObjectId data. |
| private final int[] | indexPosInOffsetOrder
Mapping from indices in offset order to indices in SHA-1 order. |
| private final int[] | nextBucketStart
The indexes into indexPosInOffsetOrder at which the next bucket starts. |
| Access | Constructor and Description |
|---|---|
| pack-priv | PackReverseIndexComputed(PackIndex
forward index - entries to (reverse) index. packIndex)Create reverse index from straight/forward pack index, by indexing all its entries. |
| Modifier and Type | Method and Description |
|---|---|
| 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. 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. 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 nthPosition)Implements org. Find the object that is in the given position in the reverse index. |
| public int | findPosition(long
the pack offset of the object offset)Implements org. 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)Implements org. Verify that the pack checksum found in the reverse index matches that from the pack file. |
| bucketSize | back to summary |
|---|---|
| private final long bucketSize The difference in offset between the start of an offset bucket and the start of its succeeding bucket. | |
| index | back to summary |
|---|---|
| private final PackIndex index Index we were created from, and that has our ObjectId data. | |
| indexPosInOffsetOrder | back to summary |
|---|---|
| private final int[] indexPosInOffsetOrder Mapping from indices in offset order to indices in SHA-1 order. | |
| nextBucketStart | back to summary |
|---|---|
| private final int[] nextBucketStart The indexes into indexPosInOffsetOrder at which the next bucket starts. For example, given offset o (and therefore bucket = o / bucketSize), the indexPos corresponding to o will be contained in the range indexPosInOffsetOrder[nextBucketStart[bucket - 1]] inclusive to indexPosInOffsetOrder[nextBucketStart[bucket]] exclusive. This range information can speed up #binarySearch by identifying the relevant bucket and only searching within its range.
See | |
| PackReverseIndexComputed | back to summary |
|---|---|
| pack-priv PackReverseIndexComputed(PackIndex packIndex) Create reverse index from straight/forward pack index, by indexing all its entries.
| |
| binarySearch | back to summary |
|---|---|
| private int binarySearch(long offset) | |
| findNextOffset | back to summary |
|---|---|
| public long findNextOffset(long offset, long maxOffset) throws CorruptObjectException Implements org. Doc from org. Search for the next offset to the specified offset in this pack (reverse) index.
| |
| findObject | back to summary |
|---|---|
| public ObjectId findObject(long offset) Implements org. Doc from org. Search for object id with the specified start offset in this pack (reverse) index. | |
| findObjectByPosition | back to summary |
|---|---|
| public ObjectId findObjectByPosition(int nthPosition) Implements org. Doc from org. Find the object that is in the given position in the reverse index. | |
| findPosition | back to summary |
|---|---|
| public int findPosition(long offset) Implements org. Doc from org. Find the position in the reverse index of the object at the given pack offset.
| |
| verifyPackChecksum | back to summary |
|---|---|
| public void verifyPackChecksum(String packFilePath) throws PackMismatchException Implements org. Doc from org. Verify that the pack checksum found in the reverse index matches that from the pack file.
| |