org.eclipse.jgit.storage.dfs
Class DfsCachedPack

java.lang.Object
  extended by org.eclipse.jgit.storage.pack.CachedPack
      extended by org.eclipse.jgit.storage.dfs.DfsCachedPack

public class DfsCachedPack
extends CachedPack

A DfsPackFile available for reuse as-is.


Method Summary
 long getDeltaCount()
          Get the number of delta objects stored in this pack.
 long getObjectCount()
          Get the number of objects in this pack.
 DfsPackDescription getPackDescription()
           
 Set<ObjectId> getTips()
          Objects that start this pack.
 boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep)
          Determine if this pack contains the object representation given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPackDescription

public DfsPackDescription getPackDescription()
Returns:
the description of the pack.

getTips

public Set<ObjectId> getTips()
Description copied from class: CachedPack
Objects that start this pack.

All objects reachable from the tips are contained within this pack. If PackWriter is going to include everything reachable from all of these objects, this cached pack is eligible to be appended directly onto the output pack stream.

Specified by:
getTips in class CachedPack
Returns:
the tip objects that describe this pack.

getObjectCount

public long getObjectCount()
                    throws IOException
Description copied from class: CachedPack
Get the number of objects in this pack.

Specified by:
getObjectCount in class CachedPack
Returns:
the total object count for the pack.
Throws:
IOException - if the object count cannot be read.

getDeltaCount

public long getDeltaCount()
                   throws IOException
Description copied from class: CachedPack
Get the number of delta objects stored in this pack.

This is an optional method, not every cached pack storage system knows the precise number of deltas stored within the pack. This number must be smaller than CachedPack.getObjectCount() as deltas are not supposed to span across pack files.

This method must be fast, if the only way to determine delta counts is to scan the pack file's contents one object at a time, implementors should return 0 and avoid the high cost of the scan.

Overrides:
getDeltaCount in class CachedPack
Returns:
the number of deltas; 0 if the number is not known or there are no deltas.
Throws:
IOException - if the delta count cannot be read.

hasObject

public boolean hasObject(ObjectToPack obj,
                         StoredObjectRepresentation rep)
Description copied from class: CachedPack
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.


Copyright © 2013. All Rights Reserved.