Class LocalCachedPack

    • Field Detail

      • packNames

        private final java.lang.String[] packNames
      • packs

        private Pack[] packs
    • Constructor Detail

      • LocalCachedPack

        LocalCachedPack​(ObjectDirectory odb,
                        java.util.List<java.lang.String> packNames)
      • LocalCachedPack

        LocalCachedPack​(java.util.List<Pack> packs)
    • Method Detail

      • getObjectCount

        public long getObjectCount()
                            throws java.io.IOException
        Get the number of objects in this pack.
        Specified by:
        getObjectCount in class CachedPack
        Returns:
        the total object count for the pack.
        Throws:
        java.io.IOException - if the object count cannot be read.
      • hasObject

        public boolean hasObject​(ObjectToPack obj,
                                 StoredObjectRepresentation rep)
        Determine if this pack contains the object representation given.

        PackWriter uses this method during the finding sources phase to prune away any objects from the leading thin-pack that already appear within this pack and should not be sent twice.

        Implementors are strongly encouraged to rely on looking at rep only and using its internal state to decide if this object is within this pack. Implementors should ensure a representation from this cached pack is tested as part of ObjectReuseAsIs.selectObjectRepresentation(PackWriter, org.eclipse.jgit.lib.ProgressMonitor, Iterable) , ensuring this method would eventually return true if the object would be included by this cached pack.

        Specified by:
        hasObject in class CachedPack
        Parameters:
        obj - the object being packed. Can be used as an ObjectId.
        rep - representation from the ObjectReuseAsIs instance that originally supplied this CachedPack.
        Returns:
        true if this pack contains this object.
      • getPacks

        private Pack[] getPacks()
                         throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • getPackFile

        private Pack getPackFile​(java.lang.String packName)
                          throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • getPackFilePath

        private java.lang.String getPackFilePath​(java.lang.String packName)