Class PackReverseIndex

  • public class PackReverseIndex
    extends Object

    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
    • Constructor Detail

      • PackReverseIndex

        public PackReverseIndex​(PackIndex packIndex)
        Create reverse index from straight/forward pack index, by indexing all its entries.
        packIndex - forward index - entries to (reverse) index.
    • Method Detail

      • findObject

        public ObjectId findObject​(long offset)
        Search for object id with the specified start offset in this pack (reverse) index.
        offset - start offset of object to find.
        object id for this offset, or null if no object was found.
      • findNextOffset

        public long findNextOffset​(long offset,
                                   long maxOffset)
                            throws CorruptObjectException
        Search for the next offset to the specified offset in this pack (reverse) index.
        offset - start offset of previous object (must be valid-existing offset).
        maxOffset - maximum offset in a pack (returned when there is no next offset).
        offset of the next object in a pack or maxOffset if provided offset was the last one.
        CorruptObjectException - when there is no object with the provided offset.