Class LocalCachedPack
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.pack.CachedPack
-
- org.eclipse.jgit.internal.storage.file.LocalCachedPack
-
class LocalCachedPack extends CachedPack
-
-
Field Summary
Fields Modifier and Type Field Description private ObjectDirectory
odb
private java.lang.String[]
packNames
private Pack[]
packs
-
Constructor Summary
Constructors Constructor Description LocalCachedPack(java.util.List<Pack> packs)
LocalCachedPack(ObjectDirectory odb, java.util.List<java.lang.String> packNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
copyAsIs(PackOutputStream out, WindowCursor wc)
long
getObjectCount()
Get the number of objects in this pack.private Pack
getPackFile(java.lang.String packName)
private java.lang.String
getPackFilePath(java.lang.String packName)
private Pack[]
getPacks()
boolean
hasObject(ObjectToPack obj, StoredObjectRepresentation rep)
Determine if this pack contains the object representation given.-
Methods inherited from class org.eclipse.jgit.internal.storage.pack.CachedPack
getDeltaCount
-
-
-
-
Field Detail
-
odb
private final ObjectDirectory odb
-
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 classCachedPack
- Returns:
- the total object count for the pack.
- Throws:
java.io.IOException
- if the object count cannot be read.
-
copyAsIs
void copyAsIs(PackOutputStream out, WindowCursor wc) throws java.io.IOException
- Throws:
java.io.IOException
-
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 ofObjectReuseAsIs.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 classCachedPack
- Parameters:
obj
- the object being packed. Can be used as an ObjectId.rep
- representation from theObjectReuseAsIs
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)
-
-