Class DfsPackFileMidxNPacks


public final class DfsPackFileMidxNPacks extends DfsPackFileMidx
Implementation of a DfsPackfile that tries to solve the queries in a multipack index before resorting to the real packs.

It uses the position in the multipack index of the objects as their "offset".

  • Field Details

    • invalidatingCause

      protected volatile Exception invalidatingCause
      Exception that caused the packfile to be flagged as invalid
  • Method Details

    • getOffsetCalculator

      protected org.eclipse.jgit.internal.storage.dfs.DfsPackFileMidxNPacks.VOffsetCalculatorNPacks getOffsetCalculator()
      Description copied from class: DfsPackFileMidx
      Get the object calculator of this midx
      Specified by:
      getOffsetCalculator in class DfsPackFileMidx
      Returns:
      an offset calculator for this midx (including its chain)
    • asObjectIdSet

      public ObjectIdSet asObjectIdSet(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFile
      Get a view of this packfile as a set of objects

      To use when the caller only needs to check inclusion (without specific order or getting offsets).

      Overrides:
      asObjectIdSet in class DfsPackFile
      Parameters:
      ctx - reader context
      Returns:
      a view of this packfile as a set of objects
      Throws:
      IOException - cannot load the backing data from storage
    • getBitmapIndex

      public PackBitmapIndex getBitmapIndex(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFile
      Get the BitmapIndex for this PackFile.
      Overrides:
      getBitmapIndex in class DfsPackFile
      Parameters:
      ctx - reader context to support reading from the backing store if the index is not already loaded in memory.
      Returns:
      the BitmapIndex.
      Throws:
      IOException - the bitmap index is not available, or is corrupt.
    • getCommitGraph

      public CommitGraph getCommitGraph(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFile
      Get the Commit Graph for this PackFile.
      Overrides:
      getCommitGraph in class DfsPackFile
      Parameters:
      ctx - reader context to support reading from the backing store if the index is not already loaded in memory.
      Returns:
      CommitGraph, null if pack doesn't have it.
      Throws:
      IOException - the Commit Graph is not available, or is corrupt.
    • getLocalObjects

      public List<ObjectToPack> getLocalObjects(DfsReader ctx) throws IOException
      Throws:
      IOException
    • getReverseIdx

      public PackReverseIndex getReverseIdx(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFile
      Get the PackReverseIndex for this PackFile.
      Specified by:
      getReverseIdx in class DfsPackFileMidx
      Parameters:
      ctx - reader context to support reading from the backing store if the index is not already loaded in memory
      Returns:
      the PackReverseIndex
      Throws:
      IOException - the pack index is not available, or is corrupt
    • getObjectCount

      protected int getObjectCount(DfsReader ctx) throws IOException
      Count of objects in this pack (i.e. including, recursively, its base)
      Overrides:
      getObjectCount in class DfsPackFileMidx
      Parameters:
      ctx - a reader
      Returns:
      count of objects in this pack, including its bases
      Throws:
      IOException - an error reading a midx in the chain
    • getChecksum

      protected byte[] getChecksum(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFileMidx
      Return checksum of the midx
      Specified by:
      getChecksum in class DfsPackFileMidx
      Parameters:
      ctx - a reader
      Returns:
      checksum of the midx
      Throws:
      IOException - an error reading the file
    • localIterator

      protected MultiPackIndex.MidxIterator localIterator(DfsReader ctx) throws IOException
      Description copied from class: DfsPackFileMidx
      Get a midx iterator over the contents of *this* midx, without the base.
      Specified by:
      localIterator in class DfsPackFileMidx
      Parameters:
      ctx - a ready
      Returns:
      an iterator over the objects in this midx in sha1 order
      Throws:
      IOException - an error loading the underlying data
    • getCoveredPacks

      public List<DfsPackFile> getCoveredPacks()
      Packs indexed by this multipack index (base NOT included)
      Specified by:
      getCoveredPacks in class DfsPackFileMidx
      Returns:
      packs indexed by this multipack index
    • getMultipackIndexBase

      public DfsPackFileMidx getMultipackIndexBase()
      Base of this multipack index

      If this midx is part of a chain, this is its parent

      Specified by:
      getMultipackIndexBase in class DfsPackFileMidx
      Returns:
      the base of this multipack index
    • findIdxPosition

      public int findIdxPosition(DfsReader ctx, AnyObjectId id) throws IOException
      Throws:
      IOException
    • hasObject

      public boolean hasObject(DfsReader ctx, AnyObjectId id) throws IOException
      Description copied from class: DfsPackFile
      Check if an object is stored within this pack.
      Overrides:
      hasObject in class DfsPackFile
      Parameters:
      ctx - reader context to support reading from the backing store if the index is not already loaded in memory.
      id - object to be located.
      Returns:
      true if the object exists in this pack; false if it does not.
      Throws:
      IOException - the pack index is not available, or is corrupt.