java.lang.Object
org.eclipse.jgit.internal.storage.file.Pack
org.eclipse.jgit.internal.storage.file.PackMidx
- All Implemented Interfaces:
Iterable<PackIndex.MutableEntry>
A pack that uses internally a midx
This pack answers what it can directly from the midx (e.g. hasObject) and sends to the right pack other calls (e.g. reading the actual object).
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClear the indexes referenced in this pack.fullyIncludedIn(BitmapIndex.BitmapBuilder needBitmaps) Return the pack if all its objects are included in the need bitmaps.Return the packs covered by this midx (in midx order)getIndex()Get the index for this pack file.longReturn the size of the object from the object-size index.longNumber of objects in the object-size index of this packGet the reverse index of this packbooleanhasObject(AnyObjectId id) Determine if an object is contained within the pack file.booleanGet the object size index for this pack fileiterator()booleanDetermines whether a .keep file exists for this pack file.Methods inherited from class org.eclipse.jgit.internal.storage.file.Pack
close, close, getPackFile, getPackName, optionally, setPackChecksum, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PackMidx
Construct a reader for existing, pre-indexed packfiles.- Parameters:
cfg- configuration this directory consults for write settings.midxFile- path of the.midxfile holding the data.knownPacks- packs in the repo to find the packs covered by this midx- Throws:
IOException- an error reading any of the files involved
-
-
Method Details
-
getCoveredPacks
Return the packs covered by this midx (in midx order)- Overrides:
getCoveredPacksin classPack- Returns:
- packs covered by this midx
-
fullyIncludedIn
Description copied from class:PackReturn the pack if all its objects are included in the need bitmaps.- Overrides:
fullyIncludedInin classPack- Parameters:
needBitmaps- bitmap with needed objects. Modified in this method: If a pack is fully included in the bitmap, the pack objects are removed from the bitmap.- Returns:
- list of packs fully included in the bitmap
- Throws:
IOException- an error reading the bitmap index of this pack
-
getIndex
Description copied from class:PackGet the index for this pack file. -
getReverseIdx
Description copied from class:PackGet the reverse index of this pack- Overrides:
getReverseIdxin classPack- Returns:
- a reverse index
-
hasObjectSizeIndex
Description copied from class:PackGet the object size index for this pack file- Overrides:
hasObjectSizeIndexin classPack- Returns:
- the object size index for this pack file if it exists (null otherwise)
- Throws:
IOException- problem reading the index
-
getObjectSizeIndexCount
public long getObjectSizeIndexCount()Description copied from class:PackNumber of objects in the object-size index of this pack- Overrides:
getObjectSizeIndexCountin classPack- Returns:
- number of objects in the index (0 if either the index is empty or it doesn't exist)
-
getIndexedObjectSize
Description copied from class:PackReturn the size of the object from the object-size index. Caller MUST check that the pack has object-size index (Pack.hasObjectSizeIndex()) and that the pack contains the object.- Overrides:
getIndexedObjectSizein classPack- Parameters:
id- object id of an object in the pack- Returns:
- size of the object from the index. Negative if the object is not in the index.
- Throws:
IOException- if an IO error occurred while reading the index
-
hasObject
Description copied from class:PackDetermine if an object is contained within the pack file.For performance reasons only the index file is searched; the main pack content is ignored entirely.
- Overrides:
hasObjectin classPack- Parameters:
id- the object to look for. Must not be null.- Returns:
- true if the object is in this pack; false otherwise.
- Throws:
IOException- the index file cannot be loaded into memory.
-
shouldBeKept
public boolean shouldBeKept()Description copied from class:PackDetermines whether a .keep file exists for this pack file.- Overrides:
shouldBeKeptin classPack- Returns:
- true if a .keep file exist.
-
closeIndices
protected void closeIndices()Description copied from class:PackClear the indexes referenced in this pack.Subclasses override this method to clear references to any index they add
- Overrides:
closeIndicesin classPack
-
iterator
Description copied from class:PackProvide iterator over entries in associated pack index, that should also exist in this pack file. Objects returned by such iterator are mutable during iteration.
Iterator returns objects in SHA-1 lexicographical order.
- Specified by:
iteratorin interfaceIterable<PackIndex.MutableEntry>- Overrides:
iteratorin classPack- See Also:
-