Top Description Constructors Methods
org.eclipse.jgit.internal.storage.pack

public abstract Class CachedPack

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.dfs.DfsCachedPack, org.eclipse.jgit.internal.storage.file.LocalCachedPack
Imports
java.io.IOException

Describes a pack file org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs can append onto a stream.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the number of deltas; 0 if the number is not known or there are no deltas.
getDeltaCount
()

Get the number of delta objects stored in this pack.

public abstract long

Returns:

the total object count for the pack.
getObjectCount
()

Get the number of objects in this pack.

public abstract boolean

Returns:

true if this pack contains this object.
hasObject
(ObjectToPack
the object being packed. Can be used as an ObjectId.
obj
,
StoredObjectRepresentation
representation from the org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs instance that originally supplied this CachedPack.
rep
)

Determine if this pack contains the object representation given.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CachedPackback to summary
public CachedPack()

Method Detail

getDeltaCountback to summary
public long getDeltaCount() throws IOException

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 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.

Returns:long

the number of deltas; 0 if the number is not known or there are no deltas.

Exceptions
IOException:
if the delta count cannot be read.
getObjectCountback to summary
public abstract long getObjectCount() throws IOException

Get the number of objects in this pack.

Returns:long

the total object count for the pack.

Exceptions
IOException:
if the object count cannot be read.
hasObjectback to summary
public abstract 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 org.eclipse.jgit.internal.storage.pack.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.

Parameters
obj:ObjectToPack

the object being packed. Can be used as an ObjectId.

rep:StoredObjectRepresentation

representation from the org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs instance that originally supplied this CachedPack.

Returns:boolean

true if this pack contains this object.