Class MidxPackList

java.lang.Object
org.eclipse.jgit.internal.storage.dfs.MidxPackList

public final class MidxPackList extends Object
Helper class to manipulate a list of packs with (maybe) midxs.
  • Method Details

    • create

      public static MidxPackList create(DfsPackFile... packs)
      Wrap the packs list into a MidxPackList

      The input list is well-formed, doesn't have duplicated packs/midxs.

      Parameters:
      packs - list of packs (regular or tip midxs)
      Returns:
      a MidxPackList instance
    • getAllPlainPacks

      public List<DfsPackFile> getAllPlainPacks()
      Get all plain packs in the list, either top-level or inside midxs

      Inside midx, the packs are in reverse lookup order. This code restores their original order. i.e. the list with packs [INSERT, midx(COMPACT-2, COMPACT-3), midx(GC, COMPACT-1)] becomes [INSERT, COMPACT-3, COMPACT-2, COMPACT-1, GC].

      Returns:
      a list of all "real" packs in this pack list, either top level or inside midxs.
    • getAllMidxPacks

      public List<DfsPackFileMidx> getAllMidxPacks()
      Get all midx in the list, either top-level or inside other midxs
      Returns:
      a list of all midxs in thist list, either top level or nested inside other midxs.
    • findAllCoveringMidxs

      public Set<DfsPackFileMidx> findAllCoveringMidxs(List<DfsPackFile> queryPacks)
      Return all the midxs that cover (directoy or indirectly) a set of packs

      In a chain like midx3(p6, p5) -> midx2(p4, p3) -> midx1(p2, p1), if we check for p3, midx3 and midx2 are covering it and midx1 is not.

      Parameters:
      queryPacks - subset of packs we are checking for coverage
      Returns:
      set of midxs from the packlist that should also be removed
    • getTopMidxPack

      public DfsPackFileMidx getTopMidxPack()
      Return the top midx of the chain in the repo

      In the unlikely case of multiple unconnected midxs, take the most recent.

      Returns:
      top midx
    • getPlainPacksNotCoveredBy

      public List<DfsPackFile> getPlainPacksNotCoveredBy(@Nullable DfsPackFileMidx midx)
      Return all the plain packs not covered by this midx or its parents.
      Parameters:
      midx - a multipack index. Null midx returns all packs in db.
      Returns:
      all the packs in the db that are not covered by this midx or its parents.
    • edit

      public MidxPackList.Builder edit()
      Get a builder to add/remove packs from the list
      Returns:
      the builder